Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Made django community feed updater more rubust in figuring out modifi…

…cation dates

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@427 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8805f2b6795a81925971bdcb252218c48de9162b 1 parent 6e60bfa
authored August 07, 2005
12  django_website/apps/aggregator/bin/update_feeds.py
@@ -17,6 +17,7 @@ def update_feeds():
17 17
             title = entry.title.encode(parsed_feed.encoding, "xmlcharrefreplace")
18 18
             guid = entry.get("id", entry.link).encode(parsed_feed.encoding, "xmlcharrefreplace")
19 19
             link = entry.link.encode(parsed_feed.encoding, "xmlcharrefreplace")
  20
+            
20 21
             if hasattr(entry, "summary"):
21 22
                 content = entry.summary
22 23
             elif hasattr(entry, "content"):
@@ -26,7 +27,16 @@ def update_feeds():
26 27
             else:
27 28
                 content = u""
28 29
             content = content.encode(parsed_feed.encoding, "xmlcharrefreplace")
29  
-            date_modified = datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed))
  30
+            
  31
+            if entry.has_key('modified_parsed'):
  32
+                date_modified = datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed))
  33
+            elif parsed_feed.feed.has_key('modified_parsed'):
  34
+                date_modified = datetime.datetime.fromtimestamp(time.mktime(parsed_feed.feed.modified_parsed))
  35
+            elif parsed_feed.has_key('modified'):
  36
+                date_modified = datetime.datetime.fromtimestamp(time.mktime(parsed_feed.modified))
  37
+            else:
  38
+                date_modified = datetime.datetime.now()
  39
+            
30 40
             try:
31 41
                 feeditem = feed.get_feeditem(guid__exact=guid)
32 42
             except feeditems.FeedItemDoesNotExist:

0 notes on commit 8805f2b

Please sign in to comment.
Something went wrong with that request. Please try again.