When using a schema the form_errors variable in cherrypy.request is not
updated (version 0.9, latest version from subversion).
For example:
class TestSchema(formencode.schema):
description = validators.MinLength(3)
class Root:
@turbogears.expose(validators=TestSchema())
def update(self, description, has_errors=False):
if has_errors:
flash(cherrypy.request.form_errors['description'])
raise HTTPRedirect, '/form'
# rest of method
This returns a key error, as the cherrypy.request.form_errors dict is
empty.
The reason for this is line 190 in controllers.py:
errors = error.error_dict
This should read:
errors.update(error.error_dict)
so that the cherrypy.request.form_errors variable is filled with the
schema errors.