On Wed, Apr 25, 2007 at 04:29:11PM +0200, Lutz Steinborn wrote:
> I've checked col.py to learn how its done and I'm a little bit
> confused how complicated its realized.

   This is the price for simplicity and elegance of the API of SQLObject.

> Is where a special reason why database driven constraints are
> used ?

   To not allow any external (non-SQLObject) program to add forbidden
values.

> If the list of choices changes you have to update the
> constraint check in the db. This isn't funny with production
> systems.

   Then just write your own column type. Publish it, if it is good enough
it will be included.

> Why not using a simple python statement like:
> if not value in list_of_choices:
>       raise someException

   It is there, hidden in validators:

    def autoConstraints(self):
        return [consts.isString, consts.InList(self.enumValues)]

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to