From 47159b1e3818d1a5f1f4eeca15356e99a12c9922 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Tue, 9 Feb 2016 23:05:50 +0100 Subject: The classic crawler is now able to update an article. Only content or title are updatable, as discussed in #27. Need to implement the notification system with the boolean when the content of an article has been updated. --- src/web/lib/article_utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/web/lib') diff --git a/src/web/lib/article_utils.py b/src/web/lib/article_utils.py index 02ca2cd1..328c27ab 100644 --- a/src/web/lib/article_utils.py +++ b/src/web/lib/article_utils.py @@ -46,11 +46,7 @@ def construct_article(entry, feed): pass else: break - content = '' - if entry.get('content'): - content = entry['content'][0]['value'] - elif entry.get('summary'): - content = entry['summary'] + content = get_article_content(entry) article_link = entry.get('link') if conf.RESOLVE_ARTICLE_URL and article_link: @@ -72,3 +68,11 @@ def construct_article(entry, feed): 'content': content, 'retrieved_date': now.isoformat(), 'date': (date or now).isoformat()} + +def get_article_content(entry): + content = '' + if entry.get('content'): + content = entry['content'][0]['value'] + elif entry.get('summary'): + content = entry['summary'] + return content -- cgit