Mercurial > libervia-pubsub
comparison sat_pubsub/backend.py @ 304:bf4098a6cbb7
log the owner JID when roster request failed
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 26 Nov 2015 14:59:24 +0100 |
parents | b8b25efae0bc |
children | 087b705493a6 |
comparison
equal
deleted
inserted
replaced
303:3c2705199108 | 304:bf4098a6cbb7 |
---|---|
589 def _getNodeGroups(self, roster, nodeIdentifier, pep): | 589 def _getNodeGroups(self, roster, nodeIdentifier, pep): |
590 d = self.storage.getNodeGroups(nodeIdentifier, pep) | 590 d = self.storage.getNodeGroups(nodeIdentifier, pep) |
591 d.addCallback(lambda groups: (roster, groups)) | 591 d.addCallback(lambda groups: (roster, groups)) |
592 return d | 592 return d |
593 | 593 |
594 def _rosterEb(self, failure): | 594 def _rosterEb(self, failure, owner_jid): |
595 log.msg("Error while getting roster: {}".format(failure.value)) | 595 log.msg("Error while getting roster of {}: {}".format(unicode(owner_jid), failure.value)) |
596 return {} | 596 return {} |
597 | 597 |
598 def _tuple2ItemData(self, items_data): | 598 def _tuple2ItemData(self, items_data): |
599 # FIXME: workaround for the use of ItemData which doesn't exist in storage | 599 # FIXME: workaround for the use of ItemData which doesn't exist in storage |
600 # must be done in a cleaner way | 600 # must be done in a cleaner way |
659 if affiliation == 'outcast': | 659 if affiliation == 'outcast': |
660 raise error.Forbidden() | 660 raise error.Forbidden() |
661 | 661 |
662 access_model = node.getAccessModel() | 662 access_model = node.getAccessModel() |
663 d = node.getNodeOwner() | 663 d = node.getNodeOwner() |
664 d.addCallback(self.privilege.getRoster) | 664 |
665 d.addErrback(self._rosterEb) | 665 def gotOwner(owner_jid): |
666 d_roster = self.privilege.getRoster(owner_jid) | |
667 d_roster.addErrback(self._rosterEb, owner_jid) | |
668 return d_roster | |
669 | |
670 d.addCallback(gotOwner) | |
666 | 671 |
667 if access_model == const.VAL_AMODEL_OPEN or affiliation == 'owner': | 672 if access_model == const.VAL_AMODEL_OPEN or affiliation == 'owner': |
668 d.addCallback(lambda roster: (True, roster)) | 673 d.addCallback(lambda roster: (True, roster)) |
669 d.addCallback(access_checked) | 674 d.addCallback(access_checked) |
670 elif access_model == const.VAL_AMODEL_ROSTER: | 675 elif access_model == const.VAL_AMODEL_ROSTER: |
1100 items_data)]) | 1105 items_data)]) |
1101 | 1106 |
1102 def _got_owner(owner_jid): | 1107 def _got_owner(owner_jid): |
1103 #return a tuple with owner_jid and roster | 1108 #return a tuple with owner_jid and roster |
1104 def rosterEb(failure): | 1109 def rosterEb(failure): |
1105 log.msg("Error while getting roster: {}".format(failure.value)) | 1110 log.msg("Error while getting roster of {}: {}".format(unicode(owner_jid), failure.value)) |
1106 return (owner_jid, {}) | 1111 return (owner_jid, {}) |
1107 | 1112 |
1108 d = self.backend.privilege.getRoster(owner_jid) | 1113 d = self.backend.privilege.getRoster(owner_jid) |
1109 d.addErrback(rosterEb) | 1114 d.addErrback(rosterEb) |
1110 d.addCallback(lambda roster: (owner_jid,roster)) | 1115 d.addCallback(lambda roster: (owner_jid,roster)) |