I can't see a good reason for storing the form errors in the Nevow context anymore (was there ever one I wonder?) and it's far more convenient to do form.errors than iforms.IFormErrors(ctx).
It looks like a reasonably trivial change to give the Form instance an empty FormErrors? instance when it's created and to add errors directly to that during processing. The renderers also need access to the errors but, if they don't already, they should have access to the form.
After that, IFormErrors can be removed and one less thing will be in the Nevow context.
The main driving force for this change is when "raising" multiple errors from the form's callback. At the moment it goes something like:
def submitted(self, ctx, form, data):
if somethingIsWrong():
errors = iforms.IFormErrors(ctx)
errors.add(forms.FieldValidationError(message, field))
...
return errors
That should simplify to:
def submitted(self, ctx, form, data):
if somethingIsWrong():
form.errors.add(forms.FieldValidationError(message, field))
...
return form.errors
It may even make sense to remove the need to *return* a FormErrors? instance. The fact that a form has errors is probably enough. Then it would be:
def submitted(self, ctx, form, data):
if somethingIsWrong():
form.errors.add(forms.FieldValidationError(message, field))
return