Opened 7 years ago

Closed 7 years ago

#17274 closed Bug (fixed)

Regression: "TIME_ZONE = None" fails if "USE_TZ = True"

Reported by: Daniel Swarbrick Owned by: nobody
Component: Internationalization Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Until the recent addition of TZ-aware dates, setting "TIME_ZONE = None" in has worked fine, as stated in the comments:

# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.

However, if "USE_TZ = True", any output of datetime objects in a template results in:

AttributeError: 'NoneType' object has no attribute 'upper'

Apparently the TZ is not being determined prior the TZ-conversion code.

Tested with svn trunk r17133.

Change History (1)

comment:1 Changed 7 years ago by Aymeric Augustin

Resolution: fixed
Status: newclosed

In [17134]:

Fixed #17274 -- Accepted TIME_ZONE = None when USE_TZ = True. Thanks pressureman for the report.

This problem only occured when pytz is installed. It's still strongly recommended to define the correct time zone in TIME_ZONE in order to use pytz' implementation and not the approximation based on system time.

Note: See TracTickets for help on using tickets.
Back to Top