aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-02-03 19:39:27 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-02-03 19:39:27 +0100
commitbf941d51eaafe3e216575a71e655530b318fadb3 (patch)
tree2d766f44ff9e0e6f23949f710ed93ac2625d2c15 /pyaggr3g470r/views.py
parentAdded naive benchmarks for Whoosh and ElasticSearch. (diff)
parentRedirec to referrer. (diff)
downloadnewspipe-bf941d51eaafe3e216575a71e655530b318fadb3.tar.gz
newspipe-bf941d51eaafe3e216575a71e655530b318fadb3.tar.bz2
newspipe-bf941d51eaafe3e216575a71e655530b318fadb3.zip
Merge branch 'master' of bitbucket.org:cedricbonhomme/pyaggr3g470r
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r--pyaggr3g470r/views.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index ee163099..80dd203c 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -89,6 +89,10 @@ def logout():
flash("Logged out successfully.", 'success')
return redirect(url_for('home'))
+def redirect_url(default='index'):
+ return request.args.get('next') or \
+ request.referrer or \
+ url_for(default)
@@ -114,7 +118,7 @@ def fetch(feed_id=None):
feed_getter = feedgetter.FeedGetter(g.user.email)
feed_getter.retrieve_feed(feed_id)
flash("New articles retrieved.", 'success')
- return redirect(url_for('home'))
+ return redirect(redirect_url())
@app.route('/about/', methods=['GET'])
@login_required
@@ -192,9 +196,14 @@ def mark_as_read(feed_id=None):
for article in unread_articles:
article.readed = True
article.save()
+ flash('Articles of the feed "' + feed.title + '" marked as read.', 'info')
+ break
+ else:
+ flash("This feed do not exist.", 'warning')
else:
models.Article.objects(readed=False).update(set__readed=True)
- return redirect(url_for('home'))
+ flash("All articles marked as read", 'info')
+ return redirect(redirect_url())
@app.route('/like/<article_id>', methods=['GET'])
@login_required
bgstack15