strip timezone before comparing 'published' with 'now'
This commit is contained in:
parent
0b354acaeb
commit
13628001fa
1 changed files with 5 additions and 0 deletions
|
@ -455,6 +455,11 @@ def hentry_to_entry(hentry, feed, backfill, now):
|
||||||
published = hentry.get('published')
|
published = hentry.get('published')
|
||||||
updated = hentry.get('updated')
|
updated = hentry.get('updated')
|
||||||
|
|
||||||
|
# make sure published timezone aware
|
||||||
|
if published and hasattr(published, 'tzinfo') and published.tzinfo:
|
||||||
|
published = published.astimezone(datetime.timezone.utc)\
|
||||||
|
.replace(tzinfo=None)
|
||||||
|
|
||||||
# retrieved time is now unless we're backfilling old posts
|
# retrieved time is now unless we're backfilling old posts
|
||||||
retrieved = now
|
retrieved = now
|
||||||
if backfill and published and published < retrieved:
|
if backfill and published and published < retrieved:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue