summaryrefslogtreecommitdiff
path: root/django/utils/timezone.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-02-11 21:50:49 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-02-11 21:56:35 +0100
commit5a3d9490f14263cc4ed78b6adcb764936b07b4ae (patch)
treefeb3d159c45b2f9f075146400b0d5f47aff674ee /django/utils/timezone.py
parent7db770b013f26b81bef878541c1016a3eb291011 (diff)
Accepted None in tzname().
This is required by the tzinfo API, see Python's docs. Also made _get_timezone_name deterministic.
Diffstat (limited to 'django/utils/timezone.py')
-rw-r--r--django/utils/timezone.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/utils/timezone.py b/django/utils/timezone.py
index a56ff0b6ab..3493e056fb 100644
--- a/django/utils/timezone.py
+++ b/django/utils/timezone.py
@@ -80,7 +80,8 @@ class LocalTimezone(tzinfo):
return ZERO
def tzname(self, dt):
- return _time.tzname[self._isdst(dt)]
+ is_dst = False if dt is None else self._isdst(dt)
+ return _time.tzname[is_dst]
def _isdst(self, dt):
tt = (dt.year, dt.month, dt.day,
@@ -145,8 +146,7 @@ def _get_timezone_name(timezone):
return timezone.zone
except AttributeError:
# for regular tzinfo objects
- local_now = datetime.now(timezone)
- return timezone.tzname(local_now)
+ return timezone.tzname(None)
# Timezone selection functions.