# HG changeset patch # User Ralph Meijer # Date 1099674239 0 # Node ID e602ddda2d6ed4df9fe8fd1e0b8d1eb4c174e656 # Parent 0947b46c096827f95f01e91ed29eaa6c5ed4ccfe Implement NodeCreationService, using the create_node() method of Storage. Replace get_supported_affiliations() by supports_publisher_affiliation() and supports_outcast_affiliation() in BackendService. Add supports_persistent_items() in BackendService. diff -r 0947b46c0968 -r e602ddda2d6e idavoll/backend.py --- a/idavoll/backend.py Wed Nov 03 17:27:57 2004 +0000 +++ b/idavoll/backend.py Fri Nov 05 17:03:59 2004 +0000 @@ -141,8 +141,14 @@ utility.EventDispatcher.__init__(self) self.storage = storage - def get_supported_affiliations(self): - return ['none', 'owner', 'outcast', 'publisher'] + def supports_publisher_affiliation(self): + return True + + def supports_outcast_affiliation(self): + return True + + def supports_persistent_items(self): + return True class PublishService(service.Service): @@ -256,3 +262,18 @@ def _do_unsubscribe(self, result, node_id, subscriber): return self.parent.storage.remove_subscription(node_id, subscriber.full()) + +class NodeCreationService(service.Service): + + __implements__ = INodeCreationService, + + def supports_instant_nodes(self): + return False + + def create_node(self, node_id, requestor): + if not node_id: + raise NoInstantNodes + + d = self.parent.storage.create_node(node_id, requestor.full()) + d.addCallback(lambda _: node_id) + return d