comparison sat_pubsub/backend.py @ 357:1167e48e5f52

handle single node on subscriptions request
author Goffi <goffi@goffi.org>
date Fri, 08 Sep 2017 08:02:05 +0200
parents c72fcbdcdab7
children 9e40fc16f4df
comparison
equal deleted inserted replaced
356:95c83899b5e9 357:1167e48e5f52
528 528
529 d = self.storage.getNode(nodeIdentifier, pep, recipient) 529 d = self.storage.getNode(nodeIdentifier, pep, recipient)
530 d.addCallback(lambda node: node.removeSubscription(subscriber)) 530 d.addCallback(lambda node: node.removeSubscription(subscriber))
531 return d 531 return d
532 532
533 def getSubscriptions(self, requestor, pep, recipient): 533 def getSubscriptions(self, requestor, nodeIdentifier, pep, recipient):
534 return self.storage.getSubscriptions(requestor, pep, recipient) 534 """retrieve subscriptions of an entity
535
536 @param requestor(jid.JID): entity who want to check subscriptions
537 @param nodeIdentifier(unicode, None): identifier of the node
538 node to get all subscriptions of a service
539 """
540 return self.storage.getSubscriptions(requestor, nodeIdentifier, pep, recipient)
535 541
536 def supportsAutoCreate(self): 542 def supportsAutoCreate(self):
537 return True 543 return True
538 544
539 def supportsCreatorCheck(self): 545 def supportsCreatorCheck(self):
614 620
615 621
616 def setNodeSchema(self, nodeIdentifier, schema, requestor, pep, recipient): 622 def setNodeSchema(self, nodeIdentifier, schema, requestor, pep, recipient):
617 """set or remove Schema of a node 623 """set or remove Schema of a node
618 624
619 @param NodeIdentifier(unicode): identifier of the pubusb node 625 @param nodeIdentifier(unicode): identifier of the pubusb node
620 @param schema(domish.Element, None): schema to set 626 @param schema(domish.Element, None): schema to set
621 None to remove schema 627 None to remove schema
622 """ 628 """
623 if not nodeIdentifier: 629 if not nodeIdentifier:
624 return defer.fail(error.NoRootNode()) 630 return defer.fail(error.NoRootNode())
1554 request.recipient) 1560 request.recipient)
1555 return d.addErrback(self._mapErrors) 1561 return d.addErrback(self._mapErrors)
1556 1562
1557 def subscriptions(self, request): 1563 def subscriptions(self, request):
1558 d = self.backend.getSubscriptions(request.sender, 1564 d = self.backend.getSubscriptions(request.sender,
1565 request.nodeIdentifier,
1559 self._isPep(request), 1566 self._isPep(request),
1560 request.recipient) 1567 request.recipient)
1561 return d.addErrback(self._mapErrors) 1568 return d.addErrback(self._mapErrors)
1562 1569
1563 def affiliations(self, request): 1570 def affiliations(self, request):