Simple patch to set the floor of feed mtime

Asheesh Laroia asheesh at creativecommons.org
Fri Jan 11 13:22:43 EST 2008


Dear Planet Planeters,

Sometimes you add a blog to your Planet that doesn't have entry time 
metadata.  You don't really want it to flood the top of your Planet.

This is a patch against Venus that I wrote a few months ago that helps fix 
this.  Let's talk about it. (-:

-- Asheesh.

--- planet/spider.py    2007-08-19 16:46:51 +0000
+++ planet/spider.py    2007-09-17 18:40:05 +0000
@@ -183,6 +183,11 @@
          mtime = None
          if not entry.has_key('updated_parsed') or not entry['updated_parsed']:
              entry['updated_parsed'] = entry.get('published_parsed',None)
+            if entry['updated_parsed'] is None: # still...
+                feed_lastbuilddate = data.feed.lastbuilddate
+                if feed_lastbuilddate is not None:
+                    parsed = feedparser._parse_date_rfc822(feed_lastbuilddate)
+                    entry['updated_parsed'] = parsed
          if entry.has_key('updated_parsed'):
              try:
                  mtime = calendar.timegm(entry.updated_parsed)



More information about the devel mailing list