Mercurial > libervia-backend
diff src/plugins/plugin_xep_0277.py @ 2264:a8eaaac4d80f
plugin XEP-0277, tools/common/data_objects: language handling
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 22 Jun 2017 09:13:28 +0200 |
parents | 5e12fc5ae52a |
children | b5befe7722d3 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py Wed Jun 21 19:47:38 2017 +0200 +++ b/src/plugins/plugin_xep_0277.py Thu Jun 22 09:13:28 2017 +0200 @@ -190,6 +190,12 @@ msg = u'No atom entry found in the pubsub item {}'.format(id_) raise failure.Failure(exceptions.DataError(msg)) + # language + try: + microblog_data[u'language'] = entry_elt[(C.NS_XML, u'lang')] + except KeyError: + pass + # atom:id try: id_elt = entry_elt.elements(NS_ATOM, 'id').next() @@ -345,6 +351,10 @@ client = self.host.getClient(profile) entry_elt = domish.Element((NS_ATOM, 'entry')) + ## language ## + if u'language' in data: + entry_elt[(C.NS_XML, u'lang')] = data[u'language'] + ## content and title ## synt = self.host.plugins["TEXT-SYNTAXES"]