| 20 | def typecast_mysql_time(s): |
| 21 | # workaround mysql issue. |
| 22 | # see http://code.djangoproject.com/ticket/433, 2763 and 2369 |
| 23 | if s == "00:00:00": |
| 24 | # an empty or invalid field gets remapped to zeros |
| 25 | return None |
| 26 | return util.typecast_time(s) |
| 27 | |
| 28 | |
| 29 | def typecast_mysql_timestamp(s): |
| 30 | # workaround mysql issue. |
| 31 | # see http://code.djangoproject.com/ticket/433, 2763 and 2369 |
| 32 | if s == "0000-00-00 00:00:00": |
| 33 | # an empty or invalid field gets remapped to zeros |
| 34 | return None |
| 35 | return util.typecast_timestamp(s) |
| 36 | |
| 37 | def typecast_mysql_date(s): |
| 38 | # workaround mysql issue. |
| 39 | # see http://code.djangoproject.com/ticket/433, 2763 and 2369 |
| 40 | if s == "0000-00-00": |
| 41 | # an empty or invalid field gets remapped to zeros |
| 42 | return None |
| 43 | return util.typecast_date(s) |
| 44 | |
23 | | FIELD_TYPE.DATETIME: util.typecast_timestamp, |
24 | | FIELD_TYPE.DATE: util.typecast_date, |
25 | | FIELD_TYPE.TIME: util.typecast_time, |
| 48 | FIELD_TYPE.DATETIME: typecast_mysql_timestamp, |
| 49 | FIELD_TYPE.DATE: typecast_mysql_date, |
| 50 | FIELD_TYPE.TIME: typecast_mysql_time, |