diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-02-09 10:39:41 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-02-09 10:39:41 +0100 |
commit | efb2bf2a65d2569ec59f85c8db862fa1aa490195 (patch) | |
tree | fed01c7f0ade0b3f785b9b441e2967ef9d802ba8 /pyaggr3g470r/views.py | |
parent | New flash message. (diff) | |
download | newspipe-efb2bf2a65d2569ec59f85c8db862fa1aa490195.tar.gz newspipe-efb2bf2a65d2569ec59f85c8db862fa1aa490195.tar.bz2 newspipe-efb2bf2a65d2569ec59f85c8db862fa1aa490195.zip |
Minor improvements to some views.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r-- | pyaggr3g470r/views.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index 84de9708..47a95d0f 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -22,7 +22,7 @@ __author__ = "Cedric Bonhomme" __version__ = "$Revision: 4.5 $" __date__ = "$Date: 2010/01/29 $" -__revision__ = "$Date: 2014/01/29 $" +__revision__ = "$Date: 2014/02/09 $" __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" @@ -168,6 +168,9 @@ def feed(feed_id=None): return render_template('feed.html', head_title=utils.clear_string(feed.title), feed=feed, tag_cloud=tag_cloud, \ first_post_date=first_article, end_post_date=last_article , nb_articles=nb_articles, \ average=average, delta=delta, elapsed=elapsed) + else: + flash("This feed do not exist.", 'warning') + return redirect(redirect_url()) @app.route('/article/<article_id>', methods=['GET']) @login_required @@ -177,6 +180,9 @@ def article(article_id=None): """ #user = models.User.objects(email=g.user.email, feeds__oid=feed_id).first() article = models.Article.objects(id=article_id).first() + if article == None: + flash("This article do not exist.", 'warning') + return redirect(redirect_url()) if not article.readed: article.readed = True article.save() @@ -215,7 +221,7 @@ def like(article_id=None): #user = models.User.objects(email=g.user.email).first() models.Article.objects(id=article_id).update(set__like= \ (not models.Article.objects(id=article_id).first().like)) - return redirect("/article/"+article_id) + return redirect(redirect_url()) @app.route('/delete/<article_id>', methods=['GET']) @login_required |