diff options
| author | Tim Graham <timograham@gmail.com> | 2017-06-19 17:59:59 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-06-20 07:12:41 -0400 |
| commit | bdf20c383f1a08248ec4be6cfc972c12dcbded04 (patch) | |
| tree | 3251c231846d68a6c021d6bdd4bd24329e42e565 /django/utils/timezone.py | |
| parent | d0f59054d0c4b2291a4e0e94ec00537f98a4ab50 (diff) | |
Fixed #28323 -- Removed unneeded normalize() in timezone.localtime() and make_naive().
Diffstat (limited to 'django/utils/timezone.py')
| -rw-r--r-- | django/utils/timezone.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/django/utils/timezone.py b/django/utils/timezone.py index 36b39f30d4..7586fef750 100644 --- a/django/utils/timezone.py +++ b/django/utils/timezone.py @@ -204,11 +204,7 @@ def localtime(value=None, timezone=None): # Emulate the behavior of astimezone() on Python < 3.6. if is_naive(value): raise ValueError("localtime() cannot be applied to a naive datetime") - value = value.astimezone(timezone) - if hasattr(timezone, 'normalize'): - # This method is available for pytz time zones. - value = timezone.normalize(value) - return value + return value.astimezone(timezone) def localdate(value=None, timezone=None): @@ -287,8 +283,4 @@ def make_naive(value, timezone=None): # Emulate the behavior of astimezone() on Python < 3.6. if is_naive(value): raise ValueError("make_naive() cannot be applied to a naive datetime") - value = value.astimezone(timezone) - if hasattr(timezone, 'normalize'): - # This method is available for pytz time zones. - value = timezone.normalize(value) - return value.replace(tzinfo=None) + return value.astimezone(timezone).replace(tzinfo=None) |
