[SQL-CVS] r4181 - SQLObject/trunk/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2010-04-20 17:52:30
|
Author: phd Date: 2010-04-20 11:52:23 -0600 (Tue, 20 Apr 2010) New Revision: 4181 Modified: SQLObject/trunk/sqlobject/col.py Log: Method StringValidator.from_python was merged with to_python. Modified: SQLObject/trunk/sqlobject/col.py =================================================================== --- SQLObject/trunk/sqlobject/col.py 2010-04-20 17:49:49 UTC (rev 4180) +++ SQLObject/trunk/sqlobject/col.py 2010-04-20 17:52:23 UTC (rev 4181) @@ -523,19 +523,7 @@ raise validators.Invalid("expected a str in the StringCol '%s', got %s %r instead" % \ (self.name, type(value), value), value, state) - def from_python(self, value, state): - if value is None: - return None - if isinstance(value, unicode): - connection = state.soObject._connection - dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" - return value.encode(dbEncoding) - if self.dataType and isinstance(value, self.dataType): - return value - if isinstance(value, (str, buffer, sqlbuilder.SQLExpression)): - return value - raise validators.Invalid("expected a str in the StringCol '%s', got %s %r instead" % \ - (self.name, type(value), value), value, state) + from_python = to_python class SOStringCol(SOStringLikeCol): |