Author: phd
Date: 2004-12-10 14:01:00 +0000 (Fri, 10 Dec 2004)
New Revision: 477
Modified:
home/phd/SQLObject/inheritance/sqlobject/col.py
Log:
Merged patch from revision 475:476: fixed a bug in UnicodeStringValidator: test if the value is None.
Modified: home/phd/SQLObject/inheritance/sqlobject/col.py
===================================================================
--- home/phd/SQLObject/inheritance/sqlobject/col.py 2004-12-10 13:59:05 UTC (rev 476)
+++ home/phd/SQLObject/inheritance/sqlobject/col.py 2004-12-10 14:01:00 UTC (rev 477)
@@ -11,8 +11,8 @@
NoDefault = sqlbuilder.NoDefault
True, False = 1==1, 0==1
-
+
########################################
## Columns
########################################
@@ -208,7 +208,7 @@
def _firebirdType(self):
return self._sqlType()
-
+
def _maxdbType(self):
return self._sqlType()
@@ -328,7 +328,7 @@
return 'BLOB SUB_TYPE TEXT'
else:
return self._sqlType()
-
+
def _maxdbType(self):
if not self.length:
return 'LONG ASCII'
@@ -344,9 +344,13 @@
self.db_encoding = db_encoding
def fromPython(self, value, state):
+ if value is None:
+ return None
return value.encode(self.db_encoding)
def toPython(self, value, state):
+ if value is None:
+ return None
return unicode(value, self.db_encoding)
class SOUnicodeCol(SOStringCol):
@@ -407,7 +411,7 @@
def _firebirdType(self):
return 'INT'
-
+
def _maxdbType(self):
return "BOOLEAN"
@@ -452,7 +456,7 @@
def _firebirdType(self):
return 'INT'
-
+
def _maxdbType(self):
return 'INT'
@@ -510,7 +514,7 @@
'idName':idName})
sql = ' '.join([sql, reference])
return sql
-
+
def maxdbCreateSQL(self):
from main import findClass
other = findClass(self.foreignKey)
@@ -562,7 +566,7 @@
checkConstraint = "CHECK (%s in (%s))" % (self.dbName, enumValues)
#NB. Return a tuple, not a string here
return "VARCHAR(%i)" % (length), checkConstraint
-
+
def _maxdbType(self):
raise "Enum type is not supported"
@@ -588,7 +592,7 @@
def _firebirdType(self):
return 'TIMESTAMP'
-
+
def _maxdbType(self):
return 'TIMESTAMP'
@@ -611,7 +615,7 @@
def _firebirdType(self):
return 'DATE'
-
+
def _maxdbType(self):
return 'DATE'
|