Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
jacob authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 django_website/apps/aggregator/bin/update_feeds.py
View
17 django_website/apps/aggregator/bin/update_feeds.py
@@ -28,13 +28,16 @@ def update_feeds():
content = u""
content = content.encode(parsed_feed.encoding, "xmlcharrefreplace")
- if entry.has_key('modified_parsed'):
- date_modified = datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed))
- elif parsed_feed.feed.has_key('modified_parsed'):
- date_modified = datetime.datetime.fromtimestamp(time.mktime(parsed_feed.feed.modified_parsed))
- elif parsed_feed.has_key('modified'):
- date_modified = datetime.datetime.fromtimestamp(time.mktime(parsed_feed.modified))
- else:
+ try:
+ if entry.has_key('modified_parsed'):
+ date_modified = datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed))
+ elif parsed_feed.feed.has_key('modified_parsed'):
+ date_modified = datetime.datetime.fromtimestamp(time.mktime(parsed_feed.feed.modified_parsed))
+ elif parsed_feed.has_key('modified'):
+ date_modified = datetime.datetime.fromtimestamp(time.mktime(parsed_feed.modified))
+ else:
+ date_modified = datetime.datetime.now()
+ except TypeError:
date_modified = datetime.datetime.now()
try:
Please sign in to comment.
Something went wrong with that request. Please try again.