I have just started working on "another" kind of declarative layer for
SQLalchemy. Infact it is more like a domain specific language for
setting up basic form orientated databases for small charities in
order to provide viable alternative to Access for simple information
storage needs.  The details of which I will not go into now.

My approach for validation is to have a function within each ORM
object, say obj.validate().  This goes off checks external metadata
(not sqlalchemy metadata) and runs the checks on that object using
formencode. If the form is a different to the database fields (say
composite inputs) the object holds the inputs and can validate both
these and the actual parameter they create (useful for unique
validations).  I will not use the full power of formencode scemas but
will use them for composite validations within a form.  I will then
collect all the validation errors from all the validators and return
them to the controller.

I have overwritten the Sessions session.add method to perform these
checks so as not flush until there are no validation errors, and if
there are, return a dict of the errors for the controller.

I just want to know if anyone can think of any reasons that this is a
terrible idea, based on a clearer understanding of sqlalchemy orm
objects then myself? as to me unless something particuarly mysterious
happens to the objects, or the session will break in some way if you
override add, it should be fine.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to