diff idavoll/memory_backend.py @ 54:62fdb37234e5

Make NodeCreationService a subclass of backend.NodeCreationService. Implement create_node() in Storage.
author Ralph Meijer <ralphm@ik.nu>
date Fri, 05 Nov 2004 17:05:36 +0000
parents 64f0986d8b35
children 0fa161c00ed9
line wrap: on
line diff
--- a/idavoll/memory_backend.py	Fri Nov 05 17:03:59 2004 +0000
+++ b/idavoll/memory_backend.py	Fri Nov 05 17:05:36 2004 +0000
@@ -96,25 +96,21 @@
 
         return defer.succeed(None)
 
+    def create_node(self, node_id, owner):
+        if node_id in self.nodes:
+            raise backend.NodeExists
+    
+        node = Node(node_id)
+        node.affiliations[owner] = 'owner'
+        self.nodes[node_id] = node
+
+        return defer.succeed(None)
+
 class BackendService(backend.BackendService):
     pass
 
-class NodeCreationService(service.Service):
-
-    __implements__ = backend.INodeCreationService,
-
-    def create_node(self, node_id, requestor):
-        if not node_id:
-            raise backend.NoInstantNodes
-
-        if node_id in self.parent.storage.nodes:
-            raise backend.NodeExists
-    
-        node = Node(node_id)
-        node.affiliations[requestor.full()] = 'owner'
-        self.parent.storage.nodes[node_id] = node
-
-        return defer.succeed({'node_id': node.id})
+class NodeCreationService(backend.NodeCreationService):
+    pass
 
 class PublishService(backend.PublishService):
     pass