aboutsummaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-16 21:48:47 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-11-16 21:48:47 +0100
commitca70e392ba7b695faeb3f076baad73948b618fa2 (patch)
tree50b868ed615acb0e1ebe61e477bfe7616a1f21da /src/web
parentBugfix: argument of type 'NoneType' is not iterable in html.unescape(). (diff)
downloadnewspipe-ca70e392ba7b695faeb3f076baad73948b618fa2.tar.gz
newspipe-ca70e392ba7b695faeb3f076baad73948b618fa2.tar.bz2
newspipe-ca70e392ba7b695faeb3f076baad73948b618fa2.zip
Bugfix: should import Article in order to resolve the 'date' column for the ordering of the 'articles' relationship.
Diffstat (limited to 'src/web')
-rw-r--r--src/web/controllers/feed.py3
-rw-r--r--src/web/models/feed.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/web/controllers/feed.py b/src/web/controllers/feed.py
index 6c41cce0..7203c37e 100644
--- a/src/web/controllers/feed.py
+++ b/src/web/controllers/feed.py
@@ -59,6 +59,9 @@ class FeedController(AbstractController):
last_post = feed.articles[0].date
except IndexError:
continue
+ except Exception as e:
+ logger.exception(e)
+ continue
elapsed = today - last_post
if elapsed > timedelta(days=nb_days):
inactives.append((feed, elapsed))
diff --git a/src/web/models/feed.py b/src/web/models/feed.py
index 7bf2ace3..2c26a71f 100644
--- a/src/web/models/feed.py
+++ b/src/web/models/feed.py
@@ -31,6 +31,7 @@ from datetime import datetime
from sqlalchemy import desc, Index
from sqlalchemy.orm import validates
from web.models.right_mixin import RightMixin
+from web.models.article import Article
class Feed(db.Model, RightMixin):
@@ -60,9 +61,9 @@ class Feed(db.Model, RightMixin):
icon_url = db.Column(db.String(), db.ForeignKey('icon.url'), default=None)
user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
category_id = db.Column(db.Integer(), db.ForeignKey('category.id'))
- articles = db.relationship('Article', backref='source', lazy='dynamic',
+ articles = db.relationship(Article, backref='source', lazy='dynamic',
cascade='all,delete-orphan',
- order_by=desc("date"))
+ order_by=desc(Article.date))
# index
idx_feed_uid_cid = Index('user_id', 'category_id')
bgstack15