relevant files:
django/utils/feedgenerator.py
Seen in version 1.9.6 and 1.10a1, probably more versions affected.
pytz._version_ = 2016.4
--
Ticket URL: <https://code.djangoproject.com/ticket/26653>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 1
* easy: 0 => 1
* needs_docs: => 0
* has_patch: 0 => 1
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
I guess a patch might look like:
{{{ #!diff
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py
index 3a91af3..2bbc7b8 100644
--- a/django/utils/feedgenerator.py
+++ b/django/utils/feedgenerator.py
@@ -26,7 +26,7 @@ from __future__ import unicode_literals
import datetime
import warnings
-from django.utils import datetime_safe, six
+from django.utils import datetime_safe, six, timezone
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_text, iri_to_uri
from django.utils.six import StringIO
@@ -223,7 +223,7 @@ class SyndicationFeed(object):
if latest_date is None or item_date > latest_date:
latest_date = item_date
- return latest_date or datetime.datetime.now()
+ return latest_date or timezone.now()
class Enclosure(object):
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:1>
Comment (by didrix):
Replying to [comment:1 timgraham]:
> I guess a patch might look like:
> {{{ #!diff
> diff --git a/django/utils/feedgenerator.py
b/django/utils/feedgenerator.py
> index 3a91af3..2bbc7b8 100644
> --- a/django/utils/feedgenerator.py
> +++ b/django/utils/feedgenerator.py
> @@ -226,7 +226,7 @@ class SyndicationFeed(object):
> - return latest_date or datetime.datetime.now()
> + return latest_date or timezone.now()
> }}}
Could also do this:
{{{ #!diff
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py
index 3a91af3..2bbc7b8 100644
--- a/django/utils/feedgenerator.py
+++ b/django/utils/feedgenerator.py
@@ -226,7 +226,7 @@ class SyndicationFeed(object):
- return latest_date or datetime.datetime.now()
+ return latest_date or timezone.localtime(timezone.now())
}}}
What do you reckon?
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:2>
Comment (by aaugustin):
Let's use UTC.
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:3>
* status: new => assigned
* owner: nobody => ketanbhatt
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:4>
Comment (by ketanbhatt):
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 a diff of the master and my branch:
https://github.com/django/django/compare/master...ketanbhatt:ticket_26653?expand=1
Please take a look and let me know the next steps.
Thank you
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:5>
* cc: berker.peksag@… (added)
* needs_better_patch: 0 => 1
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:6>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/6648 PR #6648] looks good to me.
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f31fbbae1ab1572e1637fc5ca9ae4bae66679294" f31fbba]:
{{{
#!CommitTicketReference repository=""
revision="f31fbbae1ab1572e1637fc5ca9ae4bae66679294"
Fixed #26653 -- Made SyndicationFeed.latest_post_date() return time in
UTC.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:8>
Comment (by Tim Graham <timograham@…>):
In [changeset:"37aec6b186941566a664369e031d72b2ddd204fc" 37aec6b1]:
{{{
#!CommitTicketReference repository=""
revision="37aec6b186941566a664369e031d72b2ddd204fc"
Refs #26653 -- Fixed a feedgenerator test that requires a database query
on PostgreSQL.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26653#comment:9>