aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aggregator/management/commands/loadfeeds.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/aggregator/management/commands/loadfeeds.py b/aggregator/management/commands/loadfeeds.py
index 04316b3..bedf65d 100644
--- a/aggregator/management/commands/loadfeeds.py
+++ b/aggregator/management/commands/loadfeeds.py
@@ -20,14 +20,12 @@ class Command(BaseCommand):
for entry in parsed.entries:
if not Post.objects.filter(post_id=entry.id).exists():
+ dt = entry.updated_parsed \
+ or entry.published_parsed \
+ or datetime.datetime.now()
updated = datetime.datetime(
- entry.updated_parsed.tm_year,
- entry.updated_parsed.tm_mon,
- entry.updated_parsed.tm_mday,
- entry.updated_parsed.tm_hour,
- entry.updated_parsed.tm_min,
- entry.updated_parsed.tm_sec)
-
+ dt.tm_year, dt.tm_mon, dt.tm_mday,
+ dt.tm_hour, dt.tm_min, dt.tm_sec)
post = Post(post_id=entry.id,
title=entry.title,
remote_url=entry.link,