Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26842 closed Uncategorized (invalid)

SQLite3 backend raises error when reading tz-aware datetime value

Reported by: Ryo Chijiiwa Owned by: Kenneth
Component: Database layer (models, ORM) Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When a DateTimeField in a sqlite3 backend contains a timezone-aware value, an error is raised when reading the object. This seems to happen because convert_datetimefield_value doesn't check to make sure the value is naive before passing to make_aware, which raises an error if it receives a tz-aware value.

Change History (5)

comment:1 by Kenneth, 8 years ago

Owner: changed from nobody to Kenneth
Status: newassigned

comment:2 by Kenneth, 8 years ago

SQLite doesn't support tz-aware datetimes.

comment:3 by Kenneth, 8 years ago

Resolution: invalid
Status: assignedclosed

comment:4 by Ryo Chijiiwa, 8 years ago

I have a bit of code (a unit test) that works in Django 1.7 and 1.8, but breaks in 1.9. Both 1.7 and 1.8 check the value to see if it's tz-naive (here and here) but not 1.9. Am I to interpret that this change in behavior is by design?

in reply to:  4 comment:5 by Kenneth, 8 years ago

I think an exception is the desired behavior when trying to read a tz-aware value from a db that doesn't support timezone. Here are more info I found about this change: here and here

Replying to ryochiji:

I have a bit of code (a unit test) that works in Django 1.7 and 1.8, but breaks in 1.9. Both 1.7 and 1.8 check the value to see if it's tz-naive (here and here) but not 1.9. Am I to interpret that this change in behavior is by design?

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