comparison src/memory/disco.py @ 1409:3265a2639182

massive (preventive) addition of 'u' (unicode) before the strings passed to logging functions
author souliane <souliane@mailoo.org>
date Thu, 16 Apr 2015 14:57:57 +0200
parents 069ad98b360d
children 159d16336f87
comparison
equal deleted inserted replaced
1408:8a7145138330 1409:3265a2639182
129 if jid_ is None: 129 if jid_ is None:
130 jid_ = jid.JID(client.jid.host) 130 jid_ = jid.JID(client.jid.host)
131 # we cache items only for our own server 131 # we cache items only for our own server
132 try: 132 try:
133 items = self.host.memory.getEntityData(jid_, ["DISCO_ITEMS"], client.profile)["DISCO_ITEMS"] 133 items = self.host.memory.getEntityData(jid_, ["DISCO_ITEMS"], client.profile)["DISCO_ITEMS"]
134 log.debug("[%s] disco items are in cache" % jid_.full()) 134 log.debug(u"[%s] disco items are in cache" % jid_.full())
135 except (KeyError, exceptions.UnknownEntityError): 135 except (KeyError, exceptions.UnknownEntityError):
136 log.debug("Caching [%s] disco items" % jid_.full()) 136 log.debug(u"Caching [%s] disco items" % jid_.full())
137 items = yield client.disco.requestItems(jid_, nodeIdentifier) 137 items = yield client.disco.requestItems(jid_, nodeIdentifier)
138 self.host.memory.updateEntityData(jid_, "DISCO_ITEMS", items, profile_key=client.profile) 138 self.host.memory.updateEntityData(jid_, "DISCO_ITEMS", items, profile_key=client.profile)
139 else: 139 else:
140 items = yield client.disco.requestItems(jid_, nodeIdentifier) 140 items = yield client.disco.requestItems(jid_, nodeIdentifier)
141 141
142 defer.returnValue(items) 142 defer.returnValue(items)
143 143
144 144
145 def _infosEb(self, failure, entity_jid): 145 def _infosEb(self, failure, entity_jid):
146 failure.trap(StanzaError) 146 failure.trap(StanzaError)
147 log.warning(_("Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(), 147 log.warning(_(u"Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(),
148 'error': failure.getErrorMessage()}) 148 'error': failure.getErrorMessage()})
149 149
150 def findServiceEntities(self, category, type_, jid_=None, profile_key=C.PROF_KEY_NONE): 150 def findServiceEntities(self, category, type_, jid_=None, profile_key=C.PROF_KEY_NONE):
151 """Return all available items of an entity which correspond to (category, type_) 151 """Return all available items of an entity which correspond to (category, type_)
152 152
241 for feature in byte_features: 241 for feature in byte_features:
242 s.append(feature) 242 s.append(feature)
243 s.append('<') 243 s.append('<')
244 #TODO: manage XEP-0128 data form here 244 #TODO: manage XEP-0128 data form here
245 cap_hash = b64encode(sha1(''.join(s)).digest()) 245 cap_hash = b64encode(sha1(''.join(s)).digest())
246 log.debug(_('Capability hash generated: [%s]') % cap_hash) 246 log.debug(_(u'Capability hash generated: [%s]') % cap_hash)
247 return cap_hash 247 return cap_hash
248 248
249 @defer.inlineCallbacks 249 @defer.inlineCallbacks
250 def _discoInfos(self, entity_jid_s, profile_key=C.PROF_KEY_NONE): 250 def _discoInfos(self, entity_jid_s, profile_key=C.PROF_KEY_NONE):
251 """ Discovery method for the bridge 251 """ Discovery method for the bridge