diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2015-04-16 14:29:54 +0200 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2015-04-16 14:35:50 +0200 |
commit | 32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd (patch) | |
tree | 24a5d1fff52f2f26558c34472445b3f07c979895 /pyaggr3g470r/views | |
parent | redoing sorting on SQL and allowing to reverse sorting (diff) | |
download | newspipe-32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd.tar.gz newspipe-32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd.tar.bz2 newspipe-32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd.zip |
misc bugfix (dict should be set at load time) and var renaming
Diffstat (limited to 'pyaggr3g470r/views')
-rw-r--r-- | pyaggr3g470r/views/views.py | 10 |
1 files changed, 6 insertions, 4 deletions
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') \ |