diff 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
line wrap: on
line diff
--- a/sat_pubsub/backend.py	Tue Dec 01 23:32:32 2015 +0100
+++ b/sat_pubsub/backend.py	Thu Nov 26 14:59:24 2015 +0100
@@ -591,8 +591,8 @@
         d.addCallback(lambda groups: (roster, groups))
         return d
 
-    def _rosterEb(self, failure):
-        log.msg("Error while getting roster: {}".format(failure.value))
+    def _rosterEb(self, failure, owner_jid):
+        log.msg("Error while getting roster of {}: {}".format(unicode(owner_jid), failure.value))
         return {}
 
     def _tuple2ItemData(self, items_data):
@@ -661,8 +661,13 @@
 
         access_model = node.getAccessModel()
         d = node.getNodeOwner()
-        d.addCallback(self.privilege.getRoster)
-        d.addErrback(self._rosterEb)
+
+        def gotOwner(owner_jid):
+            d_roster = self.privilege.getRoster(owner_jid)
+            d_roster.addErrback(self._rosterEb, owner_jid)
+            return d_roster
+
+        d.addCallback(gotOwner)
 
         if access_model == const.VAL_AMODEL_OPEN or affiliation == 'owner':
             d.addCallback(lambda roster: (True, roster))
@@ -1102,7 +1107,7 @@
         def _got_owner(owner_jid):
             #return a tuple with owner_jid and roster
             def rosterEb(failure):
-                log.msg("Error while getting roster: {}".format(failure.value))
+                log.msg("Error while getting roster of {}: {}".format(unicode(owner_jid), failure.value))
                 return (owner_jid, {})
 
             d = self.backend.privilege.getRoster(owner_jid)