diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-04-26 17:11:11 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-04-26 17:11:11 +0200 |
commit | 33fab300b363b1cc124028466917186e3079ac76 (patch) | |
tree | 8781ea8afa2a7b22c3a89efbccf3c6b6f902f63b /pyaggr3g470r | |
parent | Bug fix. (diff) | |
download | newspipe-33fab300b363b1cc124028466917186e3079ac76.tar.gz newspipe-33fab300b363b1cc124028466917186e3079ac76.tar.bz2 newspipe-33fab300b363b1cc124028466917186e3079ac76.zip |
This fixes #3.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/decorators.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pyaggr3g470r/decorators.py b/pyaggr3g470r/decorators.py index f4192605..565d25a6 100644 --- a/pyaggr3g470r/decorators.py +++ b/pyaggr3g470r/decorators.py @@ -4,7 +4,7 @@ from threading import Thread from functools import wraps -from flask import g +from flask import g, redirect, url_for, flash from pyaggr3g470r.models import Feed @@ -23,8 +23,10 @@ def feed_access_required(func): def decorated(*args, **kwargs): if kwargs.get('feed_id', None) != None: feed = Feed.query.filter(Feed.id == kwargs.get('feed_id', None)).first() - if (feed == None or feed.subscriber.id != g.user.id) and not g.user.is_admin(): - flash("This feed do not exist.", "danger") - return redirect(url_for('home')) - return func(*args, **kwargs) + if feed != None and (feed.subscriber.id == g.user.id or g.user.is_admin()): + return func(*args, **kwargs) + flash("This feed do not exist.", "danger") + return redirect(url_for('home')) + else: + return func(*args, **kwargs) return decorated |