From 7190134a02477d1a9c51d7fb116cb23af468c3f3 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 5 Aug 2015 17:57:23 +0200 Subject: Ensuere that the arguments is an integer. --- pyaggr3g470r/views/feed.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pyaggr3g470r/views') diff --git a/pyaggr3g470r/views/feed.py b/pyaggr3g470r/views/feed.py index bdb4f046..c369919c 100644 --- a/pyaggr3g470r/views/feed.py +++ b/pyaggr3g470r/views/feed.py @@ -132,10 +132,9 @@ def update(action, feed_id=None): readed = action == 'read' filters = {'readed__ne': readed} - nb_days = request.args.get('nb_days', None) - if nb_days is not None: - delete_before = datetime.now() - timedelta(days=int(nb_days)) - filters['date__lt'] = delete_before + nb_days = request.args.get('nb_days', 0, type=int) + if nb_days != 0: + filters['date__lt'] = datetime.now() - timedelta(days=nb_days) if feed_id: filters['feed_id'] = feed_id -- cgit