Update of /cvsroot/jtoolkit/jToolkit/data
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9967
Modified Files:
dates.py
Log Message:
cleaned up old code to handle old error in PyTime's formatting code (for weekdays)
updated references to Format to strftime...
Index: dates.py
===================================================================
RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** dates.py 9 Mar 2004 21:27:50 -0000 1.11
--- dates.py 9 Mar 2004 21:28:13 -0000 1.12
***************
*** 54,61 ****
- # TODO: support Python 2.3 datetime
- # see http://radio.weblogs.com/0124960/2003/09/11.html
- # aDateObj = datetime.datetime.fromtimestamp(time.mktime(time.strptime(aDateString, dateParseFormat)))
-
# we have copied _strptime from Python2.3 so that it can be used in earlier versions
if not hasattr(time, 'strptime'):
--- 54,57 ----
***************
*** 63,76 ****
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):
--- 59,62 ----
***************
*** 153,157 ****
return dbdatestring(self.obj,self.dbtype)
def strftime(self,*args):
! """allow passthrough to underlying object's Format method"""
return self.obj.strftime(*args)
--- 139,143 ----
return dbdatestring(self.obj,self.dbtype)
def strftime(self,*args):
! """allow passthrough to underlying object's strftime method"""
return self.obj.strftime(*args)
***************
*** 211,219 ****
else:
dateformat = formattype
! if hasattr(value,'Format'):
! # this is to correct an error in PyTime.Format (always displays weekday as Sunday)
! # TODO: remove this if the error is fixed
! if type(value) == errortimetype:
! value = date(value.year, value.month, value.day, value.hour, value.minute, value.second)
return value.strftime(dateformat)
# handle null values
--- 197,201 ----
else:
dateformat = formattype
! if hasattr(value,'strftime'):
return value.strftime(dateformat)
# handle null values
|