[python-sybase] 2.3.3 datetime module

Novitsky, Konstantin Konstantin.Novitsky at DrKW.com
Tue, 30 Dec 2003 12:54:58 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C3CEFD.78C19A6C
Content-Type: text/plain; charset="iso-8859-1"

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.


------_=_NextPart_000_01C3CEFD.78C19A6C
Content-Type: application/octet-stream; name="Sybase.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="Sybase.diff"

*** Tools/sybase-0.36/Sybase.py	Sun Apr 27 07:54:36 2003=0A--- Lib/site-pac=
kages/Sybase.py	Tue Dec 30 12:29:50 2003=0A***************=0A*** 12,18 ****=
=0A          DateTime =3D mx.DateTime
          use_datetime =3D 1
      except ImportError:
!         use_datetime =3D 0
  import sys
  import time
  import string
--- 12,24 ----=0A          DateTime =3D mx.DateTime
          use_datetime =3D 1
      except ImportError:
!         try:
!             import datetime
!             DateTime =3D datetime
!             use_datetime =3D 1
!         except ImportError:
!             use_datetime =3D 0
!=20
  import sys
  import time
  import string
***************=0A*** 184,192 ****=0A =20
  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
 =20
--- 190,206 ----=0A =20
  def _column_value(val):
      if use_datetime and type(val) is DateTimeType:
!         if DateTime.__name__ =3D=3D '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
 =20

------_=_NextPart_000_01C3CEFD.78C19A6C--