From 32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Thu, 16 Apr 2015 14:29:54 +0200 Subject: misc bugfix (dict should be set at load time) and var renaming --- pyaggr3g470r/views/views.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'pyaggr3g470r/views') diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py index c905c6e5..3b018c6d 100644 --- a/pyaggr3g470r/views/views.py +++ b/pyaggr3g470r/views/views.py @@ -236,7 +236,9 @@ def signup(): return render_template('signup.html', form=form) -def render_home(filters={}, head_title='', page_to_render='home', **kwargs): +def render_home(filters=None, head_title='', page_to_render='home', **kwargs): + if filters is None: + filters = {} feed_contr = FeedController(g.user.id) arti_contr = ArticleController(g.user.id) feeds = {feed.id: feed.title for feed in feed_contr.read()} @@ -248,7 +250,7 @@ def render_home(filters={}, head_title='', page_to_render='home', **kwargs): filter_ = request.args.get('filter_', 'unread' if page_to_render == 'home' else 'all') sort_ = request.args.get('sort_', 'date') - feed_id = int(request.args.get('feed', 0)) + feed_id = int(request.args.get('feed_id', 0)) limit = request.args.get('limit', 1000) if filter_ != 'all': @@ -269,14 +271,14 @@ def render_home(filters={}, head_title='', page_to_render='home', **kwargs): limit = int(limit) articles = articles.limit(limit) - def gen_url(filter_=filter_, sort_=sort_, limit=limit, feed=feed_id, + def gen_url(filter_=filter_, sort_=sort_, limit=limit, feed_id=feed_id, **kwargs): if page_to_render == 'search': kwargs['query'] = request.args.get('query', '') kwargs['search_title'] = request.args.get('search_title', 'on') kwargs['search_content'] = request.args.get('searc_content', 'off') return url_for(page_to_render, filter_=filter_, sort_=sort_, - limit=limit, feed=feed, **kwargs) + limit=limit, feed_id=feed_id, **kwargs) articles = list(articles) if (page_to_render == 'home' and feed_id or page_to_render == 'search') \ -- cgit