On Dec 9, 2006, at 4:05 PM, Jonathan Wight wrote:
> I'm using turbogears 1.0 (from svn branch @ r2202) and toscawidgets
> (latest from cheeseshop) to generate a form. Works fine until I turn
> on validation, as soon as I do my error handler gets triggered with
> the error message:
>
> The input field 'self' was not expected.
>
> Am I doing something wrong or is something broken? Code follows.
This is related to the way TurboGears does validation in the
@validate decorator as it introduces some unrelated variables in the
dict it passes to the Schema.
You can overcome this by defining the Schema like this:
from formencode.schema import Schema
class TGSchema(Schema):
filter_extra_fields = True
allow_extra_fields = True
and passing it as a validator to the form:
create_form = toscawidgets.forms.TableForm(fields = FormFields,
submit_text = 'Save', name="", action="/user/save", method="post",
validator=TGSchema)
The form will build it's schema from all fields' validators using
that schema. BTW, I this is more or less the way
turbogears.validators.Schema is defined for precisely the same reason...
Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---