Christoph Zwerschke wrote:
> Simon Hengel wrote:
>
>> Are there already efforts to get rid of that dependency? How much work
>> will a replacement with the built-in datetime module be?
>
>
> On Gborg, you will find a patch for this:
> http://gborg.postgresql.org/project/pygresql/bugs/bugupdate.php?1021
This patch does not work. The|One problem is in line 255:
if isinstance(x, DateTime.DateTimeType):
I replaced it with:
if isinstance(x, datetime.datetime):
I don't know if this is the way it should be! Any ideas?
Regards,
--
Simon Hengel
--- old/pgdb.py 2005-02-23 13:07:19.000000000 +0100
+++ pgdb.py 2005-08-14 16:36:20.000000000 +0200
@@ -61,9 +61,7 @@
from _pg import *
-# Marc-Andre is changing where DateTime goes. This handles it either way.
-try: from mx import DateTime
-except ImportError: import DateTime
+import datetime
### module constants
@@ -252,7 +250,7 @@
return _quote(super(_quoteitem, self).__getitem__(key))
def _quote(x):
- if isinstance(x, DateTime.DateTimeType):
+ if isinstance(x, datetime.datetime):
x = str(x)
elif isinstance(x, unicode):
x = x.encode( 'utf-8' )
@@ -416,13 +414,13 @@
# mandatory type helpers
def Date(year, month, day):
- return DateTime.DateTime(year, month, day)
+ return datetime.datetime(year, month, day)
def Time(hour, minute, second):
- return DateTime.TimeDelta(hour, minute, second)
+ return datetime.timedelta(hour, minute, second)
def Timestamp(year, month, day, hour, minute, second):
- return DateTime.DateTime(year, month, day, hour, minute, second)
+ return datetime.datetime(year, month, day, hour, minute, second)
def DateFromTicks(ticks):
return apply(Date, time.localtime(ticks)[:3])
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql