#26653 closed Cleanup/optimization (fixed)
Make syndication's lastBuildDate timezone aware
| Reported by: | didrix | Owned by: | Ketan Bhatt |
|---|---|---|---|
| Component: | contrib.syndication | Version: | 1.9 |
| Severity: | Normal | Keywords: | timezone syndication lastBuildDate |
| Cc: | berker.peksag@… | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
The lastBuildDate element in an RSS feed is not timezone aware. For instance on a non-utc timezone ('Europe/Amsterdam') it will generate a response with
<lastBuildDate>Mon, 23 May 2016 11:36:39 -0000</lastBuildDate>
while it should be
<lastBuildDate>Mon, 23 May 2016 11:36:39 +0200</lastBuildDate>
relevant files:
django/utils/feedgenerator.py
Seen in version 1.9.6 and 1.10a1, probably more versions affected.
pytz._version_ = 2016.4
Change History (9)
follow-up: 2 comment:1 by , 9 years ago
| Easy pickings: | set |
|---|---|
| Has patch: | set |
| Needs tests: | set |
| Summary: | Syndication's lastBuildDate is not timezone aware. → Make syndication's lastBuildDate timezone aware |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Bug → Cleanup/optimization |
comment:2 by , 9 years ago
Replying to timgraham:
I guess a patch might look like:
django/utils/feedgenerator.py
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 3a91af3..2bbc7b8 100644
a b class SyndicationFeed(object): 226 return latest_date or datetime.datetime.now()226 return latest_date or timezone.now()
Could also do this:
-
django/utils/feedgenerator.py
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 3a91af3..2bbc7b8 100644
a b class SyndicationFeed(object): 226 return latest_date or datetime.datetime.now()226 return latest_date or timezone.localtime(timezone.now())
What do you reckon?
comment:4 by , 9 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:5 by , 9 years ago
Hey,
This is the first time I am contributing to Django, so please help me if I do some mistakes.
I followed the steps from this guideline https://docs.djangoproject.com/en/1.9/internals/contributing/writing-code/working-with-git/
Here is the link to the branch I have done my changes on: https://github.com/ketanbhatt/django/tree/ticket_26653
And here is the PR: https://github.com/django/django/pull/6648
Please take a look and let me know the next steps.
Thank you
comment:6 by , 9 years ago
| Cc: | added |
|---|---|
| Needs tests: | unset |
| Patch needs improvement: | set |
comment:7 by , 9 years ago
| Patch needs improvement: | unset |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
PR #6648 looks good to me.
I guess a patch might look like:
django/utils/feedgenerator.py
datetime.datetime.now()