Mercurial > libervia-pubsub
diff idavoll/backend.py @ 53:e602ddda2d6e
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.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Fri, 05 Nov 2004 17:03:59 +0000 |
parents | 94e4ede2a357 |
children | 0fa161c00ed9 |
line wrap: on
line diff
--- 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