From 167e282e0dded657c40c6192395bd0e3203908be Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 5 Mar 2015 19:25:19 +0100 Subject: Fix the authenticate decorator. --- pyaggr3g470r/controllers/feed.py | 11 +++++------ pyaggr3g470r/views/api/common.py | 11 ++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/controllers/feed.py b/pyaggr3g470r/controllers/feed.py index 3d55f255..a3cdcddd 100644 --- a/pyaggr3g470r/controllers/feed.py +++ b/pyaggr3g470r/controllers/feed.py @@ -13,12 +13,11 @@ class FeedController(AbstractController): from pyaggr3g470r.controllers import UserController now = datetime.now() user = UserController(self.user_id).get(id=self.user_id) - max_last = now - timedelta(minutes=user.refresh_rate or 60) + #max_last = now - timedelta(minutes=user.refresh_rate or 60) feeds = [feed for feed in self.read(user_id=self.user_id, - error_count__lt=max_error, enabled=True, - last_retrieved__lt=max_last).limit(limit)] - - if feeds: + error_count__lt=max_error, enabled=True).limit(limit)] + #last_retrieved__lt=max_last).limit(limit)] + """if feeds: self.update({'id__in': [feed.id for feed in feeds]}, - {'last_retrieved': now}) + {'last_retrieved': now})""" return feeds diff --git a/pyaggr3g470r/views/api/common.py b/pyaggr3g470r/views/api/common.py index 4f703712..48a0d0ac 100644 --- a/pyaggr3g470r/views/api/common.py +++ b/pyaggr3g470r/views/api/common.py @@ -48,11 +48,12 @@ def authenticate(func): else: # authentication via HTTP only auth = request.authorization - user = User.query.filter(User.nickname == auth.username).first() - if user and user.check_password(auth.password) \ - and user.activation_key == "": - g.user = user - logged_in = True + if auth is not None: + user = User.query.filter(User.nickname == auth.username).first() + if user and user.check_password(auth.password) \ + and user.activation_key == "": + g.user = user + logged_in = True if logged_in: return func(*args, **kwargs) -- cgit