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

@ -18,8 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from sat.core.i18n import _
import logging
from sat.core import exceptions
from sat.core.log import getLogger
log = getLogger(__name__)
from wokkel import disco, iwokkel
from zope.interface import implements
from twisted.words.protocols.jabber.jid import JID
@ -29,9 +29,8 @@ try:
from twisted.words.protocols.xmlstream import XMPPHandler
except ImportError:
from wokkel.subprotocols import XMPPHandler
from threading import Timer
from twisted.words.xish import domish
from twisted.internet import defer, threads
from twisted.internet import defer
from sat.core.sat_main import MessageSentAndStored, AbortSendMessage
from sat.tools.misc import TriggerManager
@ -70,7 +69,7 @@ class XEP_0033(object):
Implementation for XEP 0033
"""
def __init__(self, host):
logging.info(_("Extended Stanza Addressing plugin initialization"))
log.info(_("Extended Stanza Addressing plugin initialization"))
self.host = host
self.internal_data = {}
host.trigger.add("sendMessage", self.sendMessageTrigger, TriggerManager.MIN_PRIORITY)
@ -87,8 +86,8 @@ class XEP_0033(object):
if entity is None:
return Failure(AbortSendMessage(_("XEP-0033 is being used but the server doesn't support it!")))
if mess_data["to"] != entity:
logging.warning(_("Stanzas using XEP-0033 should be addressed to %(expected)s, not %(current)s!") % {'expected': entity, 'current': mess_data["to"]})
logging.warning(_("TODO: addressing has be fixed by the backend... fix it in the frontend!"))
log.warning(_("Stanzas using XEP-0033 should be addressed to %(expected)s, not %(current)s!") % {'expected': entity, 'current': mess_data["to"]})
log.warning(_("TODO: addressing has be fixed by the backend... fix it in the frontend!"))
mess_data["to"] = entity
element = mess_data['xml'].addElement('addresses', NS_ADDRESS)
entries = [entry.split(':') for entry in mess_data['extra']['address'].split('\n') if entry != '']