changeset 1680:1e06a0f8be66

plugin XEP-0277: unicode fixes in logs
author Goffi <goffi@goffi.org>
date Wed, 25 Nov 2015 18:24:30 +0100
parents 9ff4f60de005
children c6c835046681
files src/plugins/plugin_xep_0277.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Wed Nov 25 17:19:25 2015 +0100
+++ b/src/plugins/plugin_xep_0277.py	Wed Nov 25 18:24:30 2015 +0100
@@ -68,7 +68,7 @@
 class XEP_0277(object):
 
     def __init__(self, host):
-        log.info(_("Microblogging plugin initialization"))
+        log.info(_(u"Microblogging plugin initialization"))
         self.host = host
         self._p = self.host.plugins["XEP-0060"] # this facilitate the access to pubsub plugin
         self.rt_sessions = sat_defer.RTDeferredSessions()
@@ -275,20 +275,20 @@
         try:
             author_elt = entry_elt.elements(NS_ATOM, 'author').next()
         except StopIteration:
-            log.debug("Can't find author element in item {}".format(id_))
+            log.debug(u"Can't find author element in item {}".format(id_))
         else:
             # name
             try:
                 name_elt = author_elt.elements(NS_ATOM, 'name').next()
             except StopIteration:
-                log.warning("No name element found in author element of item {}".format(id_))
+                log.warning(u"No name element found in author element of item {}".format(id_))
             else:
                 microblog_data['author'] = unicode(name_elt)
             # uri
             try:
                 uri_elt = author_elt.elements(NS_ATOM, 'uri').next()
             except StopIteration:
-                log.debug("No uri element found in author element of item {}".format(id_))
+                log.debug(u"No uri element found in author element of item {}".format(id_))
                 if publisher:
                     microblog_data['author_jid'] =  publisher
             else:
@@ -300,12 +300,12 @@
                     microblog_data['author_jid'] = item_elt.getAttribute("publisher") or ""
 
                 if not publisher:
-                    log.debug("No publisher attribute, we can't verify author jid")
+                    log.debug(u"No publisher attribute, we can't verify author jid")
                     microblog_data['author_jid_verified'] = C.BOOL_FALSE
                 elif publisher.split("/")[0] == uri.split("/")[0]:
                     microblog_data['author_jid_verified'] = C.BOOL_TRUE
                 else:
-                    log.warning("item atom:uri differs from publisher attribute: spoofing attempt? atom:uri = {} publisher = {}".format(uri, item_elt.getAttribute("publisher")))
+                    log.warning(u"item atom:uri differ from publisher attribute, spoofing attempt ? atom:uri = {} publisher = {}".format(uri, item_elt.getAttribute("publisher")))
                     microblog_data['author_jid_verified'] = C.BOOL_FALSE
             # email
             try:
@@ -514,7 +514,7 @@
         try:
             yield self._manageComments(self._p.ACCESS_OPEN, data, service, node, item_id, profile)
         except error.StanzaError:
-            log.warning("Can't create comments node for item {}".format(item_id))
+            log.warning(u"Can't create comments node for item {}".format(item_id))
         item = yield self.data2entry(data, item_id, profile)
         ret = yield self._p.publish(service, node, [item], profile_key=profile)
         defer.returnValue(ret)
@@ -590,7 +590,7 @@
 
         _jid, xmlstream = self.host.getJidNStream(profile_key)
         if not _jid:
-            log.error(_("Can't find profile's jid"))
+            log.error(_(u"Can't find profile's jid"))
             return
         _options = {self._p.OPT_ACCESS_MODEL: access, self._p.OPT_PERSIST_ITEMS: 1, self._p.OPT_MAX_ITEMS: -1, self._p.OPT_DELIVER_PAYLOADS: 1, self._p.OPT_SEND_ITEM_SUBSCRIBE: 1}
 
@@ -600,7 +600,7 @@
 
         def fatal_err(s_error):
             #Something went wrong
-            log.error(_("Can't set microblog access"))
+            log.error(_(u"Can't set microblog access"))
             raise NodeAccessChangeException()
 
         def err_cb(s_error):