diff idavoll/memory_storage.py @ 173:246911bcb699

Make node type part of node configuration.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 09 Apr 2008 11:43:16 +0000
parents bc269696ef42
children 42e23a62b57f
line wrap: on
line diff
--- a/idavoll/memory_storage.py	Tue Jan 15 14:00:07 2008 +0000
+++ b/idavoll/memory_storage.py	Wed Apr 09 11:43:16 2008 +0000
@@ -9,7 +9,8 @@
 from idavoll import error, iidavoll
 
 default_config = {"pubsub#persist_items": True,
-                  "pubsub#deliver_payloads": True}
+                  "pubsub#deliver_payloads": True,
+                  "pubsub#node_type": "leaf"}
 
 class Storage:
 
@@ -29,14 +30,14 @@
     def get_node_ids(self):
         return defer.succeed(self._nodes.keys())
 
-    def create_node(self, node_id, owner, config = None, type='leaf'):
+    def create_node(self, node_id, owner, config=None):
         if node_id in self._nodes:
             return defer.fail(error.NodeExists())
 
         if not config:
             config = copy.copy(default_config)
 
-        if type != 'leaf':
+        if config['pubsub#node_type'] != 'leaf':
             raise NotImplementedError
 
         node = LeafNode(node_id, owner, config)