[SQL-CVS] r227 - trunk/SQLObject/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2004-09-27 21:45:57
|
Author: ianb Date: 2004-09-27 13:33:17 -0400 (Mon, 27 Sep 2004) New Revision: 227 Modified: trunk/SQLObject/sqlobject/constraints.py Log: Small bug fixes Modified: trunk/SQLObject/sqlobject/constraints.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/SQLObject/sqlobject/constraints.py 2004-09-23 03:17:40 UTC (rev= 226) +++ trunk/SQLObject/sqlobject/constraints.py 2004-09-27 17:33:17 UTC (rev= 227) @@ -15,7 +15,7 @@ self.obj =3D repr(obj) self.value =3D repr(value) fullDesc =3D "%s.%s %s (you gave: %s)" \ - % (obj.__name__, col.name, desc, repr(value)) + % (obj, col.name, desc, value) ValueError.__init__(self, fullDesc, *args) =20 def isString(obj, col, value): @@ -45,7 +45,7 @@ =20 def __call__(self, obj, col, value): if value not in self.list: - raise BadValue("accepts only values in %s" % self.list, + raise BadValue("accepts only values in %s" % repr(self.list)= , obj, col, value) =20 class MaxLength: @@ -54,7 +54,12 @@ self.length =3D length =20 def __call__(self, obj, col, value): - if len(value) > self.length: + try: + length =3D len(value) + except TypeError: + raise BadValue("object does not have a length", + obj, col, value) + if length > self.length: raise BadValue("must be shorter in length than %s" % self.length, obj, col, value) |