mirror of https://github.com/django/django.git
Refs #28373 -- Stopped setting tzinfo in typecast_timestamp().
Unnecessary since cef3f2d3c6
. When
USE_TZ=True, conn_tznames is always passed to methods that use
typecast_timestamp(). Therefore, it can return naive datetimes.
This commit is contained in:
parent
ec12c37384
commit
88637064b3
|
@ -6,9 +6,7 @@ import logging
|
||||||
import time
|
import time
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db.utils import NotSupportedError
|
from django.db.utils import NotSupportedError
|
||||||
from django.utils.timezone import utc
|
|
||||||
|
|
||||||
logger = logging.getLogger('django.db.backends')
|
logger = logging.getLogger('django.db.backends')
|
||||||
|
|
||||||
|
@ -170,11 +168,10 @@ def typecast_timestamp(s): # does NOT store time zone information
|
||||||
seconds, microseconds = seconds.split('.')
|
seconds, microseconds = seconds.split('.')
|
||||||
else:
|
else:
|
||||||
microseconds = '0'
|
microseconds = '0'
|
||||||
tzinfo = utc if settings.USE_TZ else None
|
|
||||||
return datetime.datetime(
|
return datetime.datetime(
|
||||||
int(dates[0]), int(dates[1]), int(dates[2]),
|
int(dates[0]), int(dates[1]), int(dates[2]),
|
||||||
int(times[0]), int(times[1]), int(seconds),
|
int(times[0]), int(times[1]), int(seconds),
|
||||||
int((microseconds + '000000')[:6]), tzinfo
|
int((microseconds + '000000')[:6])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue