Ticket #2763: mysql-timedate-null-value-inspectdb.patch
File mysql-timedate-null-value-inspectdb.patch, 937 bytes (added by , 18 years ago) |
---|
-
util.py
43 43 ############################################### 44 44 45 45 def typecast_date(s): 46 print s 47 if s == "0000-00-00": 48 # workaround mysql issue. 49 # see http://code.djangoproject.com/ticket/2763 and 2369 50 return None 46 51 return s and datetime.date(*map(int, s.split('-'))) or None # returns None if s is null 47 52 48 53 def typecast_time(s): # does NOT store time zone information … … 57 62 def typecast_timestamp(s): # does NOT store time zone information 58 63 # "2005-07-29 15:48:00.590358-05" 59 64 # "2005-07-29 09:56:00-05" 65 if s == "0000-00-00 00:00:00": 66 # workaround mysql issue. 67 # see http://code.djangoproject.com/ticket/2763 and 2369 68 return None 60 69 if not s: return None 61 70 if not ' ' in s: return typecast_date(s) 62 71 d, t = s.split()