mirror of
https://github.com/django/django.git
synced 2025-09-26 20:19:16 +00:00
Refactored code and tests that relied on django.utils.tzinfo.
Refs #17262.
This commit is contained in:
parent
ec2778b445
commit
d9413d33b2
12 changed files with 75 additions and 76 deletions
|
@ -18,11 +18,10 @@ import calendar
|
|||
import datetime
|
||||
|
||||
from django.utils.dates import MONTHS, MONTHS_3, MONTHS_ALT, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR
|
||||
from django.utils.tzinfo import LocalTimezone
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils import six
|
||||
from django.utils.timezone import is_aware, is_naive
|
||||
from django.utils.timezone import get_default_timezone, is_aware, is_naive
|
||||
|
||||
re_formatchars = re.compile(r'(?<!\\)([aAbBcdDeEfFgGhHiIjlLmMnNoOPrsStTUuwWyYzZ])')
|
||||
re_escaped = re.compile(r'\\(.)')
|
||||
|
@ -48,7 +47,7 @@ class TimeFormat(Formatter):
|
|||
# or time objects (against established django policy).
|
||||
if isinstance(obj, datetime.datetime):
|
||||
if is_naive(obj):
|
||||
self.timezone = LocalTimezone(obj)
|
||||
self.timezone = get_default_timezone()
|
||||
else:
|
||||
self.timezone = obj.tzinfo
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue