Skip feed control when feed is empty

This commit is contained in:
Tim Van Baak 2019-06-19 18:59:02 -07:00
parent d62c3a9001
commit 22008ea47b
1 changed files with 13 additions and 12 deletions

View File

@ -80,19 +80,20 @@ def root():
} }
active_items = [read_ex] + active_items active_items = [read_ex] + active_items
# Create the feed control item if active_items:
wl_minus = [make_query_link("only - {}".format(tag), [t for t in wl if t != tag], bl) for tag in wl] # Create the feed control item
wl_plus = [make_query_link("only + {}".format(tag), wl + [tag], bl) for tag in active_tags if tag not in wl] wl_minus = [make_query_link("only - {}".format(tag), [t for t in wl if t != tag], bl) for tag in wl]
bl_minus = [make_query_link("not - {}".format(tag), wl, [t for t in bl if t != tag]) for tag in bl] wl_plus = [make_query_link("only + {}".format(tag), wl + [tag], bl) for tag in active_tags if tag not in wl]
bl_plus = [make_query_link("not + {}".format(tag), wl, bl + [tag]) for tag in active_tags if tag not in bl] bl_minus = [make_query_link("not - {}".format(tag), wl, [t for t in bl if t != tag]) for tag in bl]
body = "<pre>{}</pre>".format("\n".join(wl_minus + wl_plus + bl_minus + bl_plus)) bl_plus = [make_query_link("not + {}".format(tag), wl, bl + [tag]) for tag in active_tags if tag not in bl]
body = "<pre>{}</pre>".format("\n".join(wl_minus + wl_plus + bl_minus + bl_plus))
feed_control = { feed_control = {
'title': 'Feed Control', 'title': 'Feed Control',
'body': body, 'body': body,
'created': None, 'created': None,
} }
active_items = [feed_control] + active_items active_items = [feed_control] + active_items
return render_template("feed.html", items=active_items[:100]) return render_template("feed.html", items=active_items[:100])