2.3.3 datetime module
"Novitsky, Konstantin" <[email protected]>
| Newsgroups | gmane.comp.python.sybase |
|---|---|
| Message-ID | <7FBD1949ED99614C9B430EB69069CCA84D2D63@ibnycce133> |
The current python-sybase doesn't seem to use the latest datetime module correctly. I've made a patch (attached), so if one of the maintainers wants to merge it with the main tree - great. Thanks, KN If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender.
Sybase.diff
(application/octet-stream, 1.5 KB)
*** Tools/sybase-0.36/Sybase.py Sun Apr 27 07:54:36 2003
--- Lib/site-packages/Sybase.py Tue Dec 30 12:29:50 2003
***************
*** 12,18 ****
DateTime = mx.DateTime
use_datetime = 1
except ImportError:
! use_datetime = 0
import sys
import time
import string
--- 12,24 ----
DateTime = mx.DateTime
use_datetime = 1
except ImportError:
! try:
! import datetime
! DateTime = datetime
! use_datetime = 1
! except ImportError:
! use_datetime = 0
!
import sys
import time
import string
***************
*** 184,192 ****
def _column_value(val):
if use_datetime and type(val) is DateTimeType:
! return DateTime.DateTime(val.year, val.month + 1, val.day,
! val.hour, val.minute,
! val.second + val.msecond / 1000.0)
else:
return val
--- 190,206 ----
def _column_value(val):
if use_datetime and type(val) is DateTimeType:
! if DateTime.__name__ == 'datetime':
! return DateTime.datetime(
! val.year, val.month + 1, val.day,
! val.hour, val.minute,
! val.second, val.msecond / 1000.0
! )
! else:
! return DateTime.DateTime(
! val.year, val.month + 1, val.day,
! val.hour, val.minute,
! val.second + val.msecond / 1000.0)
else:
return val