diff options
Diffstat (limited to 'django/utils/feedgenerator.py')
| -rw-r--r-- | django/utils/feedgenerator.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 7d7c7af65c..df3cf41652 100644 --- a/django/utils/feedgenerator.py +++ b/django/utils/feedgenerator.py @@ -28,6 +28,7 @@ import urlparse from django.utils.xmlutils import SimplerXMLGenerator from django.utils.encoding import force_unicode, iri_to_uri from django.utils import datetime_safe +from django.utils.timezone import is_aware def rfc2822_date(date): # We can't use strftime() because it produces locale-dependant results, so @@ -40,7 +41,7 @@ def rfc2822_date(date): dow = days[date.weekday()] month = months[date.month - 1] time_str = date.strftime('%s, %%d %s %%Y %%H:%%M:%%S ' % (dow, month)) - if date.tzinfo: + if is_aware(date): offset = date.tzinfo.utcoffset(date) timezone = (offset.days * 24 * 60) + (offset.seconds // 60) hour, minute = divmod(timezone, 60) @@ -51,7 +52,7 @@ def rfc2822_date(date): def rfc3339_date(date): # Support datetime objects older than 1900 date = datetime_safe.new_datetime(date) - if date.tzinfo: + if is_aware(date): time_str = date.strftime('%Y-%m-%dT%H:%M:%S') offset = date.tzinfo.utcoffset(date) timezone = (offset.days * 24 * 60) + (offset.seconds // 60) |
