﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27322	get_default_timezone() / LocalTimezone does not handle None values	Daniel F Moisset	nobody	"When not using pytz, {{{django.utils.timezone.get_default_timezone()}}} returns a {{{django.utils.timezone.LocalTimezone}}} instance, which appears to be based in an example in the datetime documentation at https://docs.python.org/3.5/library/datetime.html . The examples in that documentation have a bug ( http://bugs.python.org/issue28386 ), which is related to accepting `sometz.dst(None)` method calls. That call happens when calling `some_time_instance.dst()`. You can reproduce with:

{{{
>>> from django.utils import timezone
>>> tz = timezone.get_default_timezone()
>>> tz
<django.utils.timezone.LocalTimezone object at 0x7fd71280c0b8>
>>> from datetime import time
>>> t = time(8, 30, tzinfo=tz)
>>> t.dst()
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""/home/machinalis/0/django/lib/python3.5/site-packages/django/utils/timezone.py"", line 112, in dst
    if self._isdst(dt):
  File ""/home/machinalis/0/django/lib/python3.5/site-packages/django/utils/timezone.py"", line 143, in _isdst
    return super(LocalTimezone, self)._isdst(dt)
  File ""/home/machinalis/0/django/lib/python3.5/site-packages/django/utils/timezone.py"", line 121, in _isdst
    tt = (dt.year, dt.month, dt.day,
AttributeError: 'NoneType' object has no attribute 'year'
}}}

The example above works ok if pytz is installed (because `pytz` timezone classes handle None correctly)
"	Bug	closed	Utilities	1.10	Normal	wontfix			Unreviewed	0	0	0	0	0	0
