Mercurial > libervia-backend
diff src/plugins/plugin_xep_0277.py @ 858:660b3f5b6c78
plugins groupblog, XEP-0277: attempt to clarify the code for the comments handling:
- add or update some methods docstrings
- add GroupBlog.__fillCommentsElement to factorize the code responsible to build the comments link
- do not mix up attributes names between the item own service/node and the comments service/node
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 14 Feb 2014 21:24:31 +0100 |
parents | 03addfe98b64 |
children | 64ec04991d9d |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py Thu Feb 20 17:51:51 2014 +0100 +++ b/src/plugins/plugin_xep_0277.py Fri Feb 14 21:24:31 2014 +0100 @@ -71,6 +71,12 @@ doc={}) def parseCommentUrl(self, node_url): + """Determine the fields comments_service and comments_node of a microblog data + from the href attribute of an entry's link element. For example this input: + xmpp:sat-pubsub.libervia.org?node=urn%3Axmpp%3Acomments%3A_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn%3Axmpp%3Agroupblog%3Asouliane%libervia.org + will return (JID(u'sat-pubsub.libervia.org'), 'urn:xmpp:comments:_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn:xmpp:groupblog:souliane%libervia.org') + @return: a tuple (JID, str) + """ parsed_url = urlparse.urlparse(node_url, 'xmpp') service = jid.JID(parsed_url.path) queries = parsed_url.query.split(';') @@ -154,7 +160,7 @@ microblog_data['comments_node'] = node break except (KeyError, exceptions.DataError, RuntimeError): - warning("Can't parse link") + warning(_("Can't parse the link element of pubsub entry %s") % item['id']) continue except (AttributeError, KeyError): error(_('Error while parsing atom entry for microblogging event'))