diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-03-05 21:41:58 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-03-05 21:41:58 +0100 |
commit | 930226b2c588be81891d0170c1a4b62042ac53b0 (patch) | |
tree | 2669e466f5c008462d1c435dfcac907baf1e6078 | |
parent | set again to 5... (diff) | |
download | newspipe-930226b2c588be81891d0170c1a4b62042ac53b0.tar.gz newspipe-930226b2c588be81891d0170c1a4b62042ac53b0.tar.bz2 newspipe-930226b2c588be81891d0170c1a4b62042ac53b0.zip |
Bug fix: 'sqlalchemy.exc.DataError: (DataError) LIMIT must not be negative' when loading the page /articles/id
-rw-r--r-- | pyaggr3g470r/views/article.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pyaggr3g470r/views/article.py b/pyaggr3g470r/views/article.py index 66cc0f37..a209f888 100644 --- a/pyaggr3g470r/views/article.py +++ b/pyaggr3g470r/views/article.py @@ -18,10 +18,9 @@ def articles(feed_id=None, nb_articles=-1): feed.articles = controllers.ArticleController(g.user.id)\ .read(feed_id=feed.id)\ .order_by(desc("Article.date")) - if len(feed.articles.all()) <= nb_articles: - nb_articles = -1 - if nb_articles == -1: - feed.articles = feed.articles.limit(nb_articles) + if len(feed.articles.all()) <= nb_articles or nb_articles == -1: + nb_articles = int(1e9) + feed.articles = feed.articles.limit(nb_articles) return render_template('articles.html', feed=feed, nb_articles=nb_articles) |