[Zope3-Users] zope.formlib doesn't check invariants on subschemas - need workaround

Derek Richardson derek.richardson at gatech.edu
Sat Feb 2 11:44:23 EST 2008

I have a schema, let's call it B. It contains an @invariant function. I 
observed that it is not being called during form validation.

After help from Philipp and some investigation, I determined that the 
problem is that schema B isn't itself the main form, but is nested 
within schema A as the value_type of a Tuple field. When schema A is 
validated, schema B's invariant is not checked. I think this may be a 
bug. If someone more knowledgeable will confirm, then I will open a bug 

In the mean time, I need a workaround that verifies that the invariants 
on all instances of schema B in the Tuple on schema A hold during form 
validation. My nascent idea is to put an invariant on schema A that 
checks all the invariants on all schema B instances. However, I am not 
familiar enough with formlib internals to code this up without 
significant research. Can someone help me out with an implementation for 
this workaround or an idea for a different, better workaround?



More information about the Zope3-users mailing list