João Paulo Fernandes Farias wrote:
> Hi!
> 
> I was following the discussion about form validation and I think
> validation should go into the model.
> 
> I'm not sure, but I think FormEncode integrates with SQLObject. Maybe
> Ian can provide more info on this.

SQLObject uses FormEncode validators to a limited degree.  These
validators are attached to columns; there's currently no function to
extract the schema, but that'll probably go in there, and it's fairly
simple.

However, the schema attached directly to the SQLObject class should not
be expected to be the complete validation, IMHO.  Also, those validators
are automatically applied on all updates, and some of them should not be
doubly applied; so you could apply the validation, but then you'd have
to throw the result away and do the updates directly.

I think extra validation requirements could be added to columns through
attributes, like:

    name = StringCol()
    name.formvalidate = validators.String(max=100)

And then extract these into a schema.  But while you might want this
validation on a form, I'm of the opinion that it's better to be more lax
when doing programmatic updates, especially because there might not be a
feedback cycle to correct problems (as with a human doing updates).


-- 
Ian Bicking  |  [EMAIL PROTECTED]  |  http://blog.ianbicking.org

Reply via email to