Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

django_website: be a little nicer about dealing with missing dates in…

… feeds.

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@4838 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 85e8ae78d1ddfabd39ba8775757ff8e6e52e3471 1 parent 4e77239
authored March 28, 2007
17  django_website/apps/aggregator/bin/update_feeds.py
@@ -28,13 +28,16 @@ def update_feeds():
28 28
                 content = u""
29 29
             content = content.encode(parsed_feed.encoding, "xmlcharrefreplace")
30 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:
  31
+            try:
  32
+                if entry.has_key('modified_parsed'):
  33
+                    date_modified = datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed))
  34
+                elif parsed_feed.feed.has_key('modified_parsed'):
  35
+                    date_modified = datetime.datetime.fromtimestamp(time.mktime(parsed_feed.feed.modified_parsed))
  36
+                elif parsed_feed.has_key('modified'):
  37
+                    date_modified = datetime.datetime.fromtimestamp(time.mktime(parsed_feed.modified))
  38
+                else:
  39
+                    date_modified = datetime.datetime.now()
  40
+            except TypeError:
38 41
                 date_modified = datetime.datetime.now()
39 42
 
40 43
             try:

0 notes on commit 85e8ae7

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