limit feed size to 20 items;
This commit is contained in:
parent
7bc95f53fd
commit
ea79940e1c
5
main.py
5
main.py
@ -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')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user