comparison src/plugins/plugin_xep_0077.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 d17772b0fe22
comparison
equal deleted inserted replaced
1408:8a7145138330 1409:3265a2639182
82 submit_reg_id = self.host.registerCallback(submitForm, with_data=True, one_shot=True) 82 submit_reg_id = self.host.registerCallback(submitForm, with_data=True, one_shot=True)
83 return xml_tools.dataForm2XMLUI(form, submit_reg_id) 83 return xml_tools.dataForm2XMLUI(form, submit_reg_id)
84 84
85 def _regErr(self, failure, client): 85 def _regErr(self, failure, client):
86 """Called when something is wrong with registration""" 86 """Called when something is wrong with registration"""
87 log.info(_("Registration failure: %s") % str(failure.value)) 87 log.info(_("Registration failure: %s") % unicode(failure.value))
88 raise failure 88 raise failure
89 89
90 def _regSuccess(self, answer, client, post_treat_cb): 90 def _regSuccess(self, answer, client, post_treat_cb):
91 log.debug(_("registration answer: %s") % answer.toXml()) 91 log.debug(_(u"registration answer: %s") % answer.toXml())
92 if post_treat_cb is not None: 92 if post_treat_cb is not None:
93 post_treat_cb(jid.JID(answer['from']), client.profile) 93 post_treat_cb(jid.JID(answer['from']), client.profile)
94 return {} 94 return {}
95 95
96 def _regFailure(self, failure, client): 96 def _regFailure(self, failure, client):
97 log.info(_("Registration failure: %s") % str(failure.value)) 97 log.info(_(u"Registration failure: %s") % unicode(failure.value))
98 if failure.value.condition == 'conflict': 98 if failure.value.condition == 'conflict':
99 raise exceptions.ConflictError( _("Username already exists, please choose an other one")) 99 raise exceptions.ConflictError( _("Username already exists, please choose an other one"))
100 raise failure 100 raise failure
101 101
102 def _inBandRegister(self, to_jid_s, profile_key=C.PROF_KEY_NONE): 102 def _inBandRegister(self, to_jid_s, profile_key=C.PROF_KEY_NONE):
103 return self.inBandRegister, jid.JID(to_jid_s, profile_key) 103 return self.inBandRegister, jid.JID(to_jid_s, profile_key)
104 104
105 def inBandRegister(self, to_jid, post_treat_cb=None, profile_key=C.PROF_KEY_NONE): 105 def inBandRegister(self, to_jid, post_treat_cb=None, profile_key=C.PROF_KEY_NONE):
106 """register to a target JID""" 106 """register to a target JID"""
107 client = self.host.getClient(profile_key) 107 client = self.host.getClient(profile_key)
108 log.debug(_("Asking registration for [%s]") % to_jid.full()) 108 log.debug(_(u"Asking registration for [%s]") % to_jid.full())
109 reg_request = IQ(client.xmlstream, 'get') 109 reg_request = IQ(client.xmlstream, 'get')
110 reg_request["from"] = client.jid.full() 110 reg_request["from"] = client.jid.full()
111 reg_request["to"] = to_jid.full() 111 reg_request["to"] = to_jid.full()
112 reg_request.addElement('query', NS_REG) 112 reg_request.addElement('query', NS_REG)
113 d = reg_request.send(to_jid.full()).addCallbacks(self._regOk, self._regErr, callbackArgs=[client, post_treat_cb], errbackArgs=[client]) 113 d = reg_request.send(to_jid.full()).addCallbacks(self._regOk, self._regErr, callbackArgs=[client, post_treat_cb], errbackArgs=[client])