comparison src/core/sat_main.py @ 748:a0f4a80a6536

core: bug fix for serverDiscoItems (bad use of addCallbacks)
author souliane <souliane@mailoo.org>
date Mon, 16 Dec 2013 14:36:38 +0100
parents 5aff0beddb28
children f49945d728de
comparison
equal deleted inserted replaced
747:5aff0beddb28 748:a0f4a80a6536
706 # data for this server are not in cache 706 # data for this server are not in cache
707 disco = self.profiles[profile].disco 707 disco = self.profiles[profile].disco
708 708
709 def errback(failure, method, jid_, profile): 709 def errback(failure, method, jid_, profile):
710 # the target server is not reachable 710 # the target server is not reachable
711 logging.error("disco.%s on %s failed! [%s]" % (method.func_name, jid_, profile)) 711 logging.error("disco.%s on %s failed! [%s]" % (method.func_name, jid_.userhost(), profile))
712 logging.error("reason: %s" % failure.getErrorMessage()) 712 logging.error("reason: %s" % failure.getErrorMessage())
713 if method == disco.requestInfo: 713 if method == disco.requestInfo:
714 features = self.memory.server_features.setdefault(profile, {}) 714 features = self.memory.server_features.setdefault(profile, {})
715 features.setdefault(jid_, []) 715 features.setdefault(jid_, [])
716 elif method == disco.requestItems: 716 elif method == disco.requestItems:
725 d2 = disco.requestItems(jid_).addCallback(self.serverDiscoItems, disco, jid_, profile) 725 d2 = disco.requestItems(jid_).addCallback(self.serverDiscoItems, disco, jid_, profile)
726 d2.addErrback(errback, disco.requestItems, jid_, profile) 726 d2.addErrback(errback, disco.requestItems, jid_, profile)
727 return d2.addCallback(haveItemsFeature) 727 return d2.addCallback(haveItemsFeature)
728 728
729 d = disco.requestInfo(jid_).addCallback(self.serverDisco, jid_, profile) 729 d = disco.requestInfo(jid_).addCallback(self.serverDisco, jid_, profile)
730 d.addCallbacks(callback, errback, [], [disco.requestInfo, jid_, profile]) 730 d.addCallbacks(callback, errback, [], errbackArgs=[disco.requestInfo, jid_, profile])
731 return d 731 return d
732 732
733 ## callbacks ## 733 ## callbacks ##
734 734
735 def serverDisco(self, disco, jid_=None, profile=None): 735 def serverDisco(self, disco, jid_=None, profile=None):