core: use of the new core.log module:

/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
This commit is contained in:
Goffi 2014-04-19 19:19:19 +02:00
commit 501bc92528

View file

@ -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 @@ class AdHocCommand(XMPPHandler):
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 @@ class AdHocCommand(XMPPHandler):
@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 @@ class XEP_0050(object):
('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 @@ class XEP_0050(object):
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"]