Mercurial > libervia-pubsub
comparison sat_pubsub/backend.py @ 261:65d4fed44edf
fixed notifications (a key was missing in data in some cases)
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 17 Jun 2013 01:14:31 +0200 |
parents | f0cd02c032b3 |
children | 9dfd3890e646 |
comparison
equal
deleted
inserted
replaced
260:f0cd02c032b3 | 261:65d4fed44edf |
---|---|
389 | 389 |
390 def notifyItem(items): | 390 def notifyItem(items): |
391 if items: | 391 if items: |
392 reactor.callLater(0, self.dispatch, | 392 reactor.callLater(0, self.dispatch, |
393 {'items': items, | 393 {'items': items, |
394 'nodeIdentifier': node.nodeIdentifier, | 394 'node': node, |
395 'subscription': subscription}, | 395 'subscription': subscription, |
396 }, | |
396 '//event/pubsub/notify') | 397 '//event/pubsub/notify') |
397 | 398 |
398 config = node.getConfiguration() | 399 config = node.getConfiguration() |
399 sendLastPublished = config.get('pubsub#send_last_published_item', | 400 sendLastPublished = config.get('pubsub#send_last_published_item', |
400 'never') | 401 'never') |
668 node, affiliation = result | 669 node, affiliation = result |
669 | 670 |
670 if affiliation != 'owner': | 671 if affiliation != 'owner': |
671 raise error.Forbidden() | 672 raise error.Forbidden() |
672 | 673 |
673 data = {'nodeIdentifier': node.nodeIdentifier, | 674 data = {'node': node, |
674 'redirectURI': redirectURI} | 675 'redirectURI': redirectURI} |
675 | 676 |
676 d = defer.DeferredList([cb(data) | 677 d = defer.DeferredList([cb(data) |
677 for cb in self._callbackList], | 678 for cb in self._callbackList], |
678 consumeErrors=1) | 679 consumeErrors=1) |
865 d = defer.gatherResults([d1, d2]) | 866 d = defer.gatherResults([d1, d2]) |
866 d.addCallback(_notifyAllowed) | 867 d.addCallback(_notifyAllowed) |
867 | 868 |
868 | 869 |
869 def _preDelete(self, data): | 870 def _preDelete(self, data): |
870 nodeIdentifier = data['nodeIdentifier'] | 871 nodeIdentifier = data['node'].nodeIdentifier |
871 redirectURI = data.get('redirectURI', None) | 872 redirectURI = data.get('redirectURI', None) |
872 d = self.backend.getSubscribers(nodeIdentifier) | 873 d = self.backend.getSubscribers(nodeIdentifier) |
873 d.addCallback(lambda subscribers: self.pubsubService.notifyDelete( | 874 d.addCallback(lambda subscribers: self.pubsubService.notifyDelete( |
874 self.serviceJID, | 875 self.serviceJID, |
875 nodeIdentifier, | 876 nodeIdentifier, |