1.1 --- a/macros/SharedContent.py Tue May 07 20:03:45 2013 +0200
1.2 +++ b/macros/SharedContent.py Tue May 07 22:31:11 2013 +0200
1.3 @@ -109,7 +109,6 @@
1.4
1.5 feed_type = None
1.6 update = None
1.7 - nentries = 0
1.8
1.9 events = xml.dom.pulldom.parse(feed)
1.10
1.11 @@ -170,11 +169,9 @@
1.12 if feed_type == "rss" and tagname == "item" or \
1.13 feed_type == "atom" and tagname == "entry":
1.14
1.15 - if nentries < max_entries:
1.16 - feed_updates.append(update)
1.17 + feed_updates.append(update)
1.18
1.19 update = None
1.20 - nentries += 1
1.21
1.22 finally:
1.23 feed.close()
1.24 @@ -209,6 +206,9 @@
1.25 show_content = show_content or False
1.26 max_entries = max_entries or MAX_ENTRIES
1.27
1.28 + # Retrieve updates from feeds, classifying them as missing or bad and
1.29 + # excluding them if appropriate.
1.30 +
1.31 updates = []
1.32 feeds = []
1.33 missing = []
1.34 @@ -237,6 +237,10 @@
1.35 updates.sort()
1.36 updates.reverse()
1.37
1.38 + # Truncate the number of updates to the maximum number.
1.39 +
1.40 + updates = updates[:max_entries]
1.41 +
1.42 for update in updates:
1.43
1.44 # Emit content where appropriate.