[SQL-CVS] r1786 - SQLObject/branches/0.7-bugfix/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2006-05-19 15:39:40
|
Author: phd
Date: 2006-05-19 09:39:35 -0600 (Fri, 19 May 2006)
New Revision: 1786
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/col.py
Log:
Applied the SF patch [ 1483018 ] Play nicely with DateTime from Zope.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/col.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/col.py 2006-05-19 15:39:13 UTC (rev 1785)
+++ SQLObject/branches/0.7-bugfix/sqlobject/col.py 2006-05-19 15:39:35 UTC (rev 1786)
@@ -47,7 +47,7 @@
from mx import DateTime
except ImportError:
try:
- import DateTime # old version of mxDateTime
+ import DateTime # old version of mxDateTime, or Zope's Version if we're running with Zope
except ImportError:
mxdatetime_available = False
else:
@@ -60,7 +60,10 @@
if mxdatetime_available:
DateTimeType = type(DateTime.now())
- TimeType = type(DateTime.Time())
+ if hasattr(DateTime, "Time"):
+ TimeType = type(DateTime.Time())
+ else: # Zope
+ TimeType = type(DateTime.DateTime.Time(DateTime.DateTime()))
if datetime_available:
default_datetime_implementation = DATETIME_IMPLEMENTATION
@@ -336,7 +339,7 @@
def mssqlCreateSQL(self):
return ' '.join([self.dbName, self._mssqlType()] + self._extraSQL())
-
+
def firebirdCreateSQL(self):
# Ian Sparks pointed out that fb is picky about the order
# of the NOT NULL clause in a create statement. So, we handle
@@ -707,7 +710,7 @@
def _sybaseType(self):
return 'NUMERIC(18,0) NULL'
-
+
def _mssqlType(self):
return 'INT NULL'
@@ -1079,7 +1082,7 @@
def _sybaseType(self):
return self._postgresType()
-
+
def _mssqlType(self):
"""
SQL Server doesn't have a DATE data type, to emulate we use a vc(10)
|