Update of /cvsroot/jtoolkit/jToolkit/data
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17658
Modified Files:
dates.py
Log Message:
added back in (more intelligent) support for avoiding pywintypes problems with formatting...
Index: dates.py
===================================================================
RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** dates.py 10 Mar 2004 06:55:24 -0000 1.15
--- dates.py 10 Mar 2004 06:56:49 -0000 1.16
***************
*** 57,60 ****
--- 57,69 ----
time.strptime = _strptime.strptime
+ # pywintypes has an error in time formatting, so we need to be able to detect this type on windows
+ try:
+ import pywintypes
+ errortimetype = pywintypes.TimeType
+ except ImportError:
+ errortimetype = None
+ except AttributeError:
+ # TODO: write an error message - this means that pywintypes needs to be patched for __file__ AttributeError
+ errortimetype = None
class ParseError(ValueError):
***************
*** 195,202 ****
else:
dateformat = formattype
if hasattr(value,'strftime'):
return value.strftime(dateformat)
- elif hasattr(value,'Format'):
- return value.Format(dateformat)
# handle null values
elif value is None or value == '':
--- 204,212 ----
else:
dateformat = formattype
+ # pywintypes.TimeType can't handle dates before 1970
+ if type(value) == errortimetype:
+ value = date(value.year, value.month, value.day, value.hour, value.minute, value.second)
if hasattr(value,'strftime'):
return value.strftime(dateformat)
# handle null values
elif value is None or value == '':
|