Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#10048 closed (fixed)

Check for no timezone in dateformat.py

Reported by: Claude Paroz Owned by: nobody
Component: Core (Other) Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The DateFormat class in source:django/trunk/django/utils/dateformat.py has a self.timezone attribute that can be None (self.timezone = getattr(dt, 'tzinfo', None)). However, it is not checked for None value when called in I(), T(), U() and Z() methods.

This can lead to AttributeError:

File "/usr/lib/python2.5/site-packages/django/utils/dateformat.py", line 195, in T
    name = self.timezone.tzname(self.data)

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

Change History (4)

comment:1 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:2 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [9919]) Fixed #10048 -- Handle non-existent timezone in dateformat functions.

comment:3 by Malcolm Tredinnick, 16 years ago

(In [9920]) [1.0.X] Fixed #10048 -- Handle non-existent timezone in dateformat functions.

Backport of r9919 from trunk.

comment:4 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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