Mercurial > libervia-backend
diff src/plugins/plugin_xep_0050.py @ 993:301b342c697a
core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 19 Apr 2014 19:19:19 +0200 |
parents | e1842ebcb2f3 |
children | eef1f200d733 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0050.py Sat Apr 19 16:48:26 2014 +0200 +++ b/src/plugins/plugin_xep_0050.py Sat Apr 19 19:19:19 2014 +0200 @@ -19,9 +19,10 @@ from sat.core.i18n import _, D_ from sat.core.constants import Const as C -from logging import debug, info, warning, error +from sat.core.log import getLogger +log = getLogger(__name__) from twisted.words.protocols.jabber import jid -from twisted.words.protocols.jabber import error as xmpp_error +from twisted.words.protocols import jabber from twisted.words.xish import domish from twisted.internet import defer from wokkel import disco, iwokkel, data_form, compat @@ -106,7 +107,7 @@ try: allowed.update(self.client.roster.getJidsFromGroup(group)) except exceptions.UnknownGroupError: - warning(_("The groups [%(group)s] is unknown for profile [%(profile)s])" % {'group':group, 'profile':self.client.profile})) + log.warning(_("The groups [%(group)s] is unknown for profile [%(profile)s])" % {'group':group, 'profile':self.client.profile})) if requestor.userhostJID() in allowed: return True return False @@ -169,7 +170,7 @@ @param request: original request (domish.Element) """ xmpp_condition, cmd_condition = error_constant - iq_elt = xmpp_error.StanzaError(xmpp_condition).toResponse(request) + iq_elt = jabber.error.StanzaError(xmpp_condition).toResponse(request) if cmd_condition: error_elt = iq_elt.elements(None, "error").next() error_elt.addElement(cmd_condition, NS_COMMANDS) @@ -208,7 +209,7 @@ ('item-not-found', None), ('feature-not-implemented', None), ('internal-server-error', None)) # XEP-0050 ยง4.4 Table 5 def __init__(self, host): - info(_("plugin XEP-0050 initialization")) + log.info(_("plugin XEP-0050 initialization")) self.host = host self.requesting = Sessions() self.answering = {} @@ -290,7 +291,7 @@ try: session_data = self.requesting.profileGet(data["session_id"], profile) except KeyError: - warning ("session id doesn't exist, session has probably expired") + log.warning ("session id doesn't exist, session has probably expired") # TODO: send error dialog return defer.succeed({}) session_id = data["session_id"]