[SQL-CVS] r3446 - in SQLObject/trunk: docs sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2008-05-20 14:18:35
|
Author: phd Date: 2008-05-20 08:18:29 -0600 (Tue, 20 May 2008) New Revision: 3446 Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/col.py Log: Fixed a minor bug in Set column. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2008-05-20 14:17:16 UTC (rev 3445) +++ SQLObject/trunk/docs/News.txt 2008-05-20 14:18:29 UTC (rev 3446) @@ -117,6 +117,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/trunk/sqlobject/col.py =================================================================== --- SQLObject/trunk/sqlobject/col.py 2008-05-20 14:17:16 UTC (rev 3445) +++ SQLObject/trunk/sqlobject/col.py 2008-05-20 14:18:29 UTC (rev 3446) @@ -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 |