[SQLObject] bugFix: isFloat() missing in Constraints.py
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Bud P. B. <bu...@si...> - 2003-04-10 17:46:28
|
Well, against promise. Here is a bug fix: The module Constraints seems to fail to implement isFloat(...). I added the following def isFloat(obj, col, value): if type(value) is not type(1.1): raise BadValue("only allows floating point numbers", obj, col, value) and it seems to fix the problem. In detail, here is my test #================================================ #!/usr/local/bin/python from SQLObject import * class Sight(SQLObject): _columns = [ FloatCol('lat'),] #================================================ and the error message: #================================================ Traceback (most recent call last): File "./test.py", line 6, in ? class Sight(SQLObject): File "./test.py", line 8, in Sight _columns = [ FloatCol('lat'),] File "/usr/local/lib/python2.2/site-packages/SQLObject/Col.py", line 59, in __init__ constraints = self.autoConstraints() + constraints File "/usr/local/lib/python2.2/site-packages/SQLObject/Col.py", line 186, in autoConstraints return [Constraints.isFloat] AttributeError: 'module' object has no attribute 'isFloat' #================================================ cheers --b /----------------------------------------------------------------- | Bud P. Bruegger, Ph.D. | Sistema (www.sistema.it) | Via U. Bassi, 54 | 58100 Grosseto, Italy | +39-0564-411682 (voice and fax) \----------------------------------------------------------------- |