[Zope] Question about InvariantsValidator on a GroupForm (z3c.form)

Oliver Roch oliver.roch at brainson.de
Wed Mar 18 13:20:51 EDT 2009


Hi all,

i'm having a problem getting an InvariantsValidator working on a grouped form using z3c.form. Imagine the following setup:

class GroupOne(Group):
        fields = Fields(IMyForm).select('second_attribute', 'third_attribute')

class GroupTwo(Group):
        fields = Fields(IMyForm).select('fourth_attribute', 'fifth_attribute')

class MyForm(GroupForm, Form):
        fields = Fields(IMyForm).select('first_attribute')
        groups = (GroupOne, GroupTwo)


Now, the z3c.form.validator.Data object passed to my InvariantsValidator only contains the 'first_attribute'. I think this is caused by line 190 in field.py:

def validate(self, data):
        fields = self.form.fields.values()

Why is this method only looking for form.fields and not aggregating form.fields and possible form.groups?

Is it an unsupported use case, or am i just not getting it?


Thanks,
Oliver


More information about the Zope mailing list