Opened 14 years ago

Closed 13 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: master
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


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) (993 bytes) - added by cephelo@… 14 years ago.
django\db\backends\ patch

Download all attachments as: .zip

Change History (3)

Changed 14 years ago by cephelo@…

Attachment: added

django\db\backends\ patch

comment:1 Changed 13 years ago by Malcolm Tredinnick

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 Changed 13 years ago by cephelo@…

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