add formencode.Schema subclass for convenience

This commit is contained in:
Lance Edgar 2012-11-06 18:22:36 -08:00
parent 8fe6198954
commit 50bd5bbf4d

View file

@ -26,15 +26,29 @@
``edbob.pyramid.forms.simpleform`` -- pyramid_simpleform Forms ``edbob.pyramid.forms.simpleform`` -- pyramid_simpleform Forms
""" """
import pyramid_simpleform
from pyramid.renderers import render from pyramid.renderers import render
import formencode
import pyramid_simpleform
from pyramid_simpleform.renderers import FormRenderer from pyramid_simpleform.renderers import FormRenderer
from edbob.pyramid import helpers from edbob.pyramid import helpers
from edbob.pyramid.forms import Form from edbob.pyramid.forms import Form
__all__ = ['SimpleForm'] __all__ = ['Schema', 'SimpleForm']
class Schema(formencode.Schema):
"""
Subclass of ``formencode.Schema``, which exists only to ignore extra
fields. These normally would cause a schema instance to be deemed invalid,
and pretty much *every* form has a submit button which would be considered
an extra field.
"""
allow_extra_fields = True
filter_extra_fields = True
class SimpleForm(Form): class SimpleForm(Form):