plugin XEP-0277, tools/common/data_objects: language handling
This commit is contained in:
parent
98d328ca47
commit
9ae18d4d28
2 changed files with 14 additions and 0 deletions
|
|
@ -190,6 +190,12 @@ class XEP_0277(object):
|
||||||
msg = u'No atom entry found in the pubsub item {}'.format(id_)
|
msg = u'No atom entry found in the pubsub item {}'.format(id_)
|
||||||
raise failure.Failure(exceptions.DataError(msg))
|
raise failure.Failure(exceptions.DataError(msg))
|
||||||
|
|
||||||
|
# language
|
||||||
|
try:
|
||||||
|
microblog_data[u'language'] = entry_elt[(C.NS_XML, u'lang')]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
# atom:id
|
# atom:id
|
||||||
try:
|
try:
|
||||||
id_elt = entry_elt.elements(NS_ATOM, 'id').next()
|
id_elt = entry_elt.elements(NS_ATOM, 'id').next()
|
||||||
|
|
@ -345,6 +351,10 @@ class XEP_0277(object):
|
||||||
client = self.host.getClient(profile)
|
client = self.host.getClient(profile)
|
||||||
entry_elt = domish.Element((NS_ATOM, 'entry'))
|
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 ##
|
## content and title ##
|
||||||
synt = self.host.plugins["TEXT-SYNTAXES"]
|
synt = self.host.plugins["TEXT-SYNTAXES"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,10 @@ class BlogItem(object):
|
||||||
def updated(self):
|
def updated(self):
|
||||||
return self.mb_data.get(u'updated')
|
return self.mb_data.get(u'updated')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def language(self):
|
||||||
|
return self.mb_data.get(u'language')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def author(self):
|
def author(self):
|
||||||
return self.mb_data.get(u'author')
|
return self.mb_data.get(u'author')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue