Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
jacob authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 django_website/apps/aggregator/bin/update_feeds.py
View
12 django_website/apps/aggregator/bin/update_feeds.py
@@ -17,6 +17,7 @@ def update_feeds():
title = entry.title.encode(parsed_feed.encoding, "xmlcharrefreplace")
guid = entry.get("id", entry.link).encode(parsed_feed.encoding, "xmlcharrefreplace")
link = entry.link.encode(parsed_feed.encoding, "xmlcharrefreplace")
+
if hasattr(entry, "summary"):
content = entry.summary
elif hasattr(entry, "content"):
@@ -26,7 +27,16 @@ def update_feeds():
else:
content = u""
content = content.encode(parsed_feed.encoding, "xmlcharrefreplace")
- date_modified = datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed))
+
+ 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()
+
try:
feeditem = feed.get_feeditem(guid__exact=guid)
except feeditems.FeedItemDoesNotExist:
Please sign in to comment.
Something went wrong with that request. Please try again.