Skip to content

Commit

Permalink
[SDESK-4757] 'Abstract' from news item was missing when planning item…
Browse files Browse the repository at this point in the history
… was exported as article (superdesk#1358)
  • Loading branch information
nrvikas committed Oct 15, 2019
1 parent 30ae9e6 commit ab7c8e5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions server/planning/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,17 @@ def get_first_paragraph_text(input_string):
logger.warning(e)
else:
# all non-empty paragraphs: ignores <p><br></p> sections
for p in elem.iterfind('.//p'):
if p.text:
return p.text
return get_text_from_elem(elem) or get_text_from_elem(elem, tag=None)


def get_text_from_elem(elem, tag='.//p'):
if not tag:
for t in elem.itertext():
return t # Return first text item

for p in elem.iterfind(tag):
if p.text:
return p.text


def get_delivery_publish_time(updates, original={}):
Expand Down

0 comments on commit ab7c8e5

Please sign in to comment.