plugin XEP-0277: accept several <title/> elements, there is a standard issue so for now it's the most flexible behaviour
This commit is contained in:
parent
8a1e54b194
commit
9cc2a923fa
1 changed files with 17 additions and 5 deletions
|
|
@ -207,14 +207,26 @@ class XEP_0277(object):
|
|||
microblog_data['atom_id'] = unicode(id_elt)
|
||||
|
||||
# title/content(s)
|
||||
try:
|
||||
title_elt = entry_elt.elements(NS_ATOM, 'title').next()
|
||||
except StopIteration:
|
||||
|
||||
# FIXME: ATOM and XEP-0277 only allow 1 <title/> element
|
||||
# but in the wild we have some blogs with several ones
|
||||
# so we don't respect the standard for now (it doesn't break
|
||||
# anything anyway), and we'll find a better option later
|
||||
# try:
|
||||
# title_elt = entry_elt.elements(NS_ATOM, 'title').next()
|
||||
# except StopIteration:
|
||||
# msg = u'No atom title found in the pubsub item {}'.format(id_)
|
||||
# raise failure.Failure(exceptions.DataError(msg))
|
||||
title_elts = list(entry_elt.elements(NS_ATOM, 'title'))
|
||||
if not title_elts:
|
||||
msg = u'No atom title found in the pubsub item {}'.format(id_)
|
||||
raise failure.Failure(exceptions.DataError(msg))
|
||||
for title_elt in title_elts:
|
||||
yield parseElement(title_elt)
|
||||
|
||||
yield parseElement(title_elt)
|
||||
|
||||
# FIXME: as for <title/>, Atom only authorise at most 1 content
|
||||
# but XEP-0277 allows several ones. So for no we handle as
|
||||
# if more than one can be present
|
||||
for content_elt in entry_elt.elements(NS_ATOM, 'content'):
|
||||
yield parseElement(content_elt)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue