Opened 18 years ago

Closed 18 years ago

#3044 closed enhancement (invalid)

Add datetime check to django.db.backends.util date/time functions

Reported by: cephelo@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently if you pass datetime types to the typecast_time and typecast_timestamp functions, they throw TypeErrors. A simple change enhances the functionality of these functions (attached a patch) in that if you pass a date/time/datetime, it simply returns it. Passing a different type to a function of the wrong type still returns raises exceptions as it does now.

Patch is against changeset:4086.

Attachments (1)

util.py.diff (993 bytes ) - added by cephelo@… 18 years ago.
django\db\backends\util.py patch

Download all attachments as: .zip

Change History (3)

by cephelo@…, 18 years ago

Attachment: util.py.diff added

django\db\backends\util.py patch

comment:1 by Malcolm Tredinnick, 18 years ago

Why is this needed? Those conversion functions are only intended for use by database backends and if a backend can do the conversion to Python datetime types natively, it doesn't need to call the conversion functions. Is there are backend that does not behave this way?

comment:2 by cephelo@…, 18 years ago

Resolution: invalid
Status: newclosed

This isn't needed anymore, no. At the time, MySQLdb for Win32 was doing some wonky things, but I think it has evened out. I haven't used the patch since shortly after I posted it.

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