plugin XEP-0277: unicode fixes in logs
This commit is contained in:
parent
8181d8c08c
commit
e78b225922
1 changed files with 9 additions and 9 deletions
|
|
@ -68,7 +68,7 @@ class NodeAccessChangeException(Exception):
|
|||
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 @@ class XEP_0277(object):
|
|||
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 @@ class XEP_0277(object):
|
|||
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 @@ class XEP_0277(object):
|
|||
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 @@ class XEP_0277(object):
|
|||
|
||||
_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 @@ class XEP_0277(object):
|
|||
|
||||
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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue