]> projects.mako.cc - iron-blogger/commitdiff
Improve the logic for choosing a link from a feed.
authorNelson Elhage <nelhage@mit.edu>
Tue, 29 Dec 2009 04:16:55 +0000 (23:16 -0500)
committerNelson Elhage <nelhage@mit.edu>
Tue, 29 Dec 2009 18:29:18 +0000 (13:29 -0500)
report.py
templates/email.txt

index 2c9a97e584bee6c6bacfa2de6cb87505018b8d84..e782c499841ccee207e13313a1931ca4d51bb229 100644 (file)
--- a/report.py
+++ b/report.py
@@ -20,9 +20,15 @@ def get_date(post):
     return post.updated
 
 def get_link(post):
     return post.updated
 
 def get_link(post):
+    if 'links' in post:
+        links = dict((l.rel, l) for l in post.links if 'html' in l.type)
+        if 'self' in links:
+            return links['self'].href
+        elif 'alternate' in links:
+            return links['alternate'].href
     if 'href' in post:
         return post.href
     if 'href' in post:
         return post.href
-    return post.links[0]['href']
+    return None
 
 def parse_feeds(weeks, uri):
     feed = feedparser.parse(uri)
 
 def parse_feeds(weeks, uri):
     feed = feedparser.parse(uri)
index 106141c9012d2a968a9fdd8cb991120da8a1b101..741e373cebfcfeb9d17787feb7fd93d68fd5786b 100644 (file)
@@ -1,4 +1,4 @@
-Subject: IRON BLOGGER results for the week of ${week_start.strftime("%F")}
+Subject: IRON BLOGGER results for the week beginning ${week_start.strftime("%F")}
 To: iron-blogger@mit.edu
 
 People who posted:
 To: iron-blogger@mit.edu
 
 People who posted:

Benjamin Mako Hill || Want to submit a patch?