changeset 504:249a2305a323

only display unique page titles in rss feed
author sheep@ghostwheel
date Sat, 08 Nov 2008 04:32:19 +0100
parents ec14036ad776
children 228acb1c7088
files dandelion/history.py
diffstat 1 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/dandelion/history.py	Sun Nov 02 00:37:56 2008 +0100
+++ b/dandelion/history.py	Sat Nov 08 04:32:19 2008 +0100
@@ -86,19 +86,22 @@
 def rss_action(wiki, request):
     changes = []
     count = 0
+    titles = {}
     for page in wiki.history():
-        count += 1
-        if count > 10:
-            break
-        if page.date is not None:
-            change = {
-                'rev': page.rev,
-                'date': page.date.strftime("%a, %d %b %Y %H:%M:%S GMT"),
-                'author': page.author,
-                'comment': page.comment,
-                'title': page.title,
-            }
-            changes.append(change)
+        if page.title not in titles:
+            titles[page.title] = True
+            count += 1
+            if count > 10:
+                break
+            if page.date is not None:
+                change = {
+                    'rev': page.rev,
+                    'date': page.date.strftime("%a, %d %b %Y %H:%M:%S GMT"),
+                    'author': page.author,
+                    'comment': page.comment,
+                    'title': page.title,
+                }
+                changes.append(change)
     content = wiki.template_stream("rss.xml", page, changes=changes,
         now=datetime.datetime.now().strftime("%a, %d %b %Y %H:%M:%S GMT"))
     return Response(content.render('xml'), mimetype="application/xml")