Author: phd
Date: 2008-05-20 08:17:16 -0600 (Tue, 20 May 2008)
New Revision: 3445
Modified:
SQLObject/branches/0.10/docs/News.txt
SQLObject/branches/0.10/sqlobject/col.py
Log:
Fixed a minor bug in Set column.
Modified: SQLObject/branches/0.10/docs/News.txt
===================================================================
--- SQLObject/branches/0.10/docs/News.txt 2008-05-20 14:14:49 UTC (rev 3444)
+++ SQLObject/branches/0.10/docs/News.txt 2008-05-20 14:17:16 UTC (rev 3445)
@@ -94,6 +94,8 @@
SQLObject 0.9.7
===============
+* Fixed a minor bug in Set column.
+
* A bug fixed for RowCreatedSignal together with InheritableSQLObject:
run post_funcs after the entire hierarchy has been created.
Modified: SQLObject/branches/0.10/sqlobject/col.py
===================================================================
--- SQLObject/branches/0.10/sqlobject/col.py 2008-05-20 14:14:49 UTC (rev 3444)
+++ SQLObject/branches/0.10/sqlobject/col.py 2008-05-20 14:17:16 UTC (rev 3445)
@@ -905,6 +905,21 @@
def __init__(self, foreignKey=None, **kw):
super(ForeignKey, self).__init__(foreignKey=foreignKey, **kw)
+
+class EnumValidator(validators.Validator):
+
+ def to_python(self, value, state):
+ if value in self.enumValues:
+ return value
+ elif not self.notNone and value is None:
+ return None
+ else:
+ raise validators.Invalid("expected a member of %r in the EnumCol '%s', got %r instead" % \
+ (self.enumValues, self.name, value), value, state)
+
+ def from_python(self, value, state):
+ return self.to_python(value, state)
+
class SOEnumCol(SOCol):
def __init__(self, **kw):
@@ -963,20 +978,6 @@
else:
return len(obj)
-class EnumValidator(validators.Validator):
-
- def to_python(self, value, state):
- if value in self.enumValues:
- return value
- elif not self.notNone and value is None:
- return None
- else:
- raise validators.Invalid("expected a member of %r in the EnumCol '%s', got %r instead" % \
- (self.enumValues, self.name, value), value, state)
-
- def from_python(self, value, state):
- return self.to_python(value, state)
-
class EnumCol(Col):
baseClass = SOEnumCol
@@ -1012,7 +1013,7 @@
super(SOSetCol, self).createValidators()
def _mysqlType(self):
- return "SET(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
+ return "SET(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.setValues])
class SetCol(Col):
baseClass = SOSetCol
|