Author: phd
Date: 2005-01-05 14:39:54 +0000 (Wed, 05 Jan 2005)
New Revision: 515
Modified:
trunk/SQLObject/sqlobject/col.py
Log:
Raise InvalidField instead of TypeError.
Modified: trunk/SQLObject/sqlobject/col.py
===================================================================
--- trunk/SQLObject/sqlobject/col.py 2005-01-05 14:38:39 UTC (rev 514)
+++ trunk/SQLObject/sqlobject/col.py 2005-01-05 14:39:54 UTC (rev 515)
@@ -379,16 +379,16 @@
if value is None:
return None
if not isinstance(value, (int, long, sqlbuilder.SQLExpression)):
- raise TypeError, "expected an int in the IntCol '%s', got %s instead" % \
- (self.name, type(value))
+ raise validators.InvalidField("expected an int in the IntCol '%s', got %s instead" % \
+ (self.name, type(value)), value, state)
return value
def toPython(self, value, state):
if value is None:
return None
if not isinstance(value, (int, long, sqlbuilder.SQLExpression)):
- raise TypeError, "expected an int in the IntCol '%s', got %s instead" % \
- (self.name, type(value))
+ raise validators.InvalidField("expected an int in the IntCol '%s', got %s instead" % \
+ (self.name, type(value)), value, state)
return value
class SOIntCol(SOCol):
|