﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2763	"[patch] Inspect db crashes with MySQL date ""0000-00-00"" - Quick fix included"	mvassallo+django@…	Adrian Holovaty	"When using inspectdb to create a model of a legacy database (s**** postnuke stuff) the program encounters a timestamp value of ""0000-00-00"". This is valid in MySQL, but the code hangs on it, so i just added an if. It could be more elegant, but it works.
This is the patch:

--- util.py     2006-09-19 02:53:48.000000000 -0300
+++ util.py-patched     2006-09-19 02:42:39.000000000 -0300
@@ -43,6 +43,7 @@
 ###############################################
 
 def typecast_date(s):
+    if s == ""0000-00-00"" : return None
     return s and datetime.date(*map(int, s.split('-'))) or None # returns None if s is null
 
 def typecast_time(s): # does NOT store time zone information
"	defect	closed	django-admin.py inspectdb		normal	fixed	inspectdb		Ready for checkin	1	0	1	1	0	0
