tickets_full: 3418

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
3418 2007-02-02 17:03:36 2008-07-07 14:58:40 2019-06-24 00:51:38.856557 Design decision needed closed Tools     master invalid MSSQL and OverflowError for django/utils/tzinfo.py {{{ Exception Type: OverflowError Exception Value: mktime argument out of range Exception Location: C:\opt\Python25\lib\site-packages\django\utils\tzinfo.py in _isdst, line 50 }}} This kind of errors appears when you work with SQL Server (or transfered data from MSSQL to MySQL). SQL Server converts NULLs in its datetime field into year 1900! And this raise exception OverflowError with message "mktime argument out of range" for pythonic function time.mktime() used in utils/tzinfo.py at line 50: {{{ def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = time.mktime(tt) tt = time.localtime(stamp) return tt.tm_isdst > 0 }}} This is monkey patched code which solves this problem: {{{ def _isdst(self, dt): year = dt.year if year == 1900: # or < 1970 year = 1970 tt = (year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = time.mktime(tt) tt = time.localtime(stamp) return tt.tm_isdst > 0 }}} Used Django SVN rev.4455, WinXP Pro. nobody Jaroslaw Zabiello ado_mssql datetime overflow 0 1 1 0 0 0
Powered by Datasette · Query took 3.912ms