aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/lib
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-07-06 21:21:52 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-07-06 21:44:51 +0200
commit30b48eb41a9515feaf7dbc5cd4eb8847371b237c (patch)
treeab33ed59f2d09cd5aa5f30f28e190ecec9a7cbad /pyaggr3g470r/lib
parentMinor fixes from a quick review. Need to test deeper. (diff)
downloadnewspipe-30b48eb41a9515feaf7dbc5cd4eb8847371b237c.tar.gz
newspipe-30b48eb41a9515feaf7dbc5cd4eb8847371b237c.tar.bz2
newspipe-30b48eb41a9515feaf7dbc5cd4eb8847371b237c.zip
adding feed icons on feed pages
Diffstat (limited to 'pyaggr3g470r/lib')
-rw-r--r--pyaggr3g470r/lib/article_utils.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pyaggr3g470r/lib/article_utils.py b/pyaggr3g470r/lib/article_utils.py
index 3c642167..79ac34f5 100644
--- a/pyaggr3g470r/lib/article_utils.py
+++ b/pyaggr3g470r/lib/article_utils.py
@@ -35,6 +35,8 @@ def extract_id(entry, keys=[('link', 'link'),
def construct_article(entry, feed):
+ if hasattr(feed, 'dump'): # this way can be a sqlalchemy obj or a dict
+ feed = feed.dump()
"Safe method to transorm a feedparser entry into an article"
now = datetime.now()
@@ -63,10 +65,10 @@ def construct_article(entry, feed):
logger.warning("Unable to get the real URL of %s. Error: %s",
article_link, error)
- return {'feed_id': feed.id,
- 'user_id': feed.user_id,
+ return {'feed_id': feed['id'],
+ 'user_id': feed['user_id'],
'entry_id': extract_id(entry).get('entry_id', None),
- 'link': entry.get('link', feed.site_link),
+ 'link': entry.get('link', feed['site_link']),
'title': entry.get('title', 'No title'),
'readed': False, 'like': False,
'content': content,
bgstack15