limit feed size to 20 items;

This commit is contained in:
Benjamin Bouvier 2018-04-09 22:49:46 +02:00
parent 7bc95f53fd
commit ea79940e1c
1 changed files with 5 additions and 0 deletions

View File

@ -146,6 +146,7 @@ def by_feed_name(slug):
gen.link(href=feed.atom_id)
gen.description(feed.description)
count = 0
for item in feed.items.order_by(Item.date):
fe = gen.add_entry()
fe.id(item.atom_id)
@ -155,6 +156,10 @@ def by_feed_name(slug):
date = item.date.replace(tzinfo=timezone.utc)
fe.published(date)
count += 1
if count == 20:
break
return gen.rss_str(pretty=True).decode('utf8')