aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-04-16 14:29:54 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-04-16 14:35:50 +0200
commit32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd (patch)
tree24a5d1fff52f2f26558c34472445b3f07c979895
parentredoing sorting on SQL and allowing to reverse sorting (diff)
downloadnewspipe-32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd.tar.gz
newspipe-32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd.tar.bz2
newspipe-32d9ec9a9c0d1e7ff6a8e947c5205fcebcd1a4bd.zip
misc bugfix (dict should be set at load time) and var renaming
-rw-r--r--pyaggr3g470r/templates/home.html4
-rw-r--r--pyaggr3g470r/views/views.py10
2 files changed, 8 insertions, 6 deletions
diff --git a/pyaggr3g470r/templates/home.html b/pyaggr3g470r/templates/home.html
index 10ad82cb..a31d65e1 100644
--- a/pyaggr3g470r/templates/home.html
+++ b/pyaggr3g470r/templates/home.html
@@ -14,7 +14,7 @@
{% if not feed_id %}</b>{% endif %}
</a></li>
{% for fid, nbunread in unread|dictsort(by='value')|reverse %}
- <li class="feed-menu"><a href="{{ gen_url(feed=fid) }}">
+ <li class="feed-menu"><a href="{{ gen_url(feed_id=fid) }}">
{% if feed_id == fid %}<b>{% endif %}
{% if in_error.get(fid, 0) > 0 %}
<span style="background-color: {{ "red" if in_error[fid] > conf.DEFAULT_MAX_ERROR -1 else "orange" }} ;" class="badge pull-right" title="Some errors occured while trying to retrieve that feed.">{{ in_error[fid] }} {{ _("error") }}{% if in_error[fid] > 1 %}s{% endif %}</span>
@@ -33,7 +33,7 @@
</span></li>
{% endfor %}
{% for fid, ftitle in feeds|dictsort(case_sensitive=False, by='value') if not fid in unread %}
- <li class="feed-menu"><a href="{{ gen_url(feed=fid) }}">
+ <li class="feed-menu"><a href="{{ gen_url(feed_id=fid) }}">
{% if in_error.get(fid, 0) > 0 %}
<span style="background-color: {{ "red" if in_error[fid] > conf.DEFAULT_MAX_ERROR - 1 else "orange" }} ;" class="badge pull-right" title="Some errors occured while trying to retrieve that feed.">{{ in_error[fid] }} {{ _("error") }}{% if in_error[fid] > 1 %}s{% endif %}</span>
{% endif %}
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') \
bgstack15