core (tools/common): data objects first draft:

this module aims is to help manipulate complex data from bridge, mainly for the template system.
    It is in common and not only in frontends as it may be used in some case by backend, if it needs to use template system in the future.
This commit is contained in:
Goffi 2017-02-21 21:01:40 +01:00
commit 8d578cec3b

View file

@ -608,9 +608,9 @@ class XEP_0277(object):
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%40libervia.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)
xmpp:sat-pubsub.example.net?;node=urn%3Axmpp%3Acomments%3A_af43b363-3259-4b2a-ba4c-1bc33aa87634__urn%3Axmpp%3Agroupblog%3Asomebody%40example.net
will return(JID(u'sat-pubsub.example.net'), 'urn:xmpp:comments:_af43b363-3259-4b2a-ba4c-1bc33aa87634__urn:xmpp:groupblog:somebody@example.net')
@return (tuple[jid.JID, unicode]): service and node
"""
parsed_url = urlparse.urlparse(node_url, 'xmpp')
service = jid.JID(parsed_url.path)