Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#17263 closed Cleanup/optimization (fixed)

When time zone support is active, raise a warning when a naive datetime reaches the database adapter

Reported by: Aymeric Augustin Owned by: Aymeric Augustin
Component: Database layer (models, ORM) Version:
Severity: Release blocker Keywords:
Cc: anssi.kaariainen@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I haven't done it because I thought it would be too obnoxious -- for instance, if you're using a third-party app that uses datetimes in a non-trivial way and hasn't been upgraded yet.

But a good argument in favor of such a warning was made on the mailing list, and it's easy to filter the warning out with one line in your settings file if you don't care.

Attachments (1)

17263.patch (6.5 KB ) - added by Aymeric Augustin 12 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Luke Plant, 12 years ago

Severity: NormalRelease blocker
Triage Stage: Design decision neededAccepted

Agreed, and in fact I think we should ensure this gets in for 1.4, so that we can mention it in the upgrading notes, therefore making it a release blocker.

comment:2 by Anssi Kääriäinen, 12 years ago

Cc: anssi.kaariainen@… added

comment:3 by Aymeric Augustin, 12 years ago

Adding this warning shows that Django still uses naive datetimes in many places, including the cache framework, the date based generic views, the "auth" and "comments" contrib apps.

by Aymeric Augustin, 12 years ago

Attachment: 17263.patch added

comment:4 by Aymeric Augustin, 12 years ago

Has patch: set

Attached patch adds a warning (with docs and tests).

comment:5 by Aymeric Augustin, 12 years ago

Resolution: fixed
Status: newclosed

In [17117]:

Fixed #17263 -- Added a warning when a naive datetime reaches the database layer while time zone support is enabled.

After this commit, timezones.AdminTests will raise warnings because the sessions contrib app hasn't been upgraded to support time zones yet.
This will be fixed in an upcoming commit.

comment:6 by Aymeric Augustin, 12 years ago

In [17126]:

Ensured that the warning added at r17117 also applies to queryset filter arguments. Refs #17263.

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