add formencode.Schema subclass for convenience
This commit is contained in:
parent
8fe6198954
commit
50bd5bbf4d
1 changed files with 16 additions and 2 deletions
|
@ -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):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue