# HG changeset patch # User Goffi # Date 1498115608 -7200 # Node ID a8eaaac4d80fc3fade729f7084f447720f4fa57d # Parent 90189f312fd337b0ea9ce54da04e9f7a64888b76 plugin XEP-0277, tools/common/data_objects: language handling diff -r 90189f312fd3 -r a8eaaac4d80f src/plugins/plugin_xep_0277.py --- 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"] diff -r 90189f312fd3 -r a8eaaac4d80f src/tools/common/data_objects.py --- a/src/tools/common/data_objects.py Wed Jun 21 19:47:38 2017 +0200 +++ b/src/tools/common/data_objects.py Thu Jun 22 09:13:28 2017 +0200 @@ -52,6 +52,10 @@ return self.mb_data.get(u'updated') @property + def language(self): + return self.mb_data.get(u'language') + + @property def author(self): return self.mb_data.get(u'author')