Browse Source

simplified form generation from schema

php2python
Holger Frey 7 years ago
parent
commit
44d5e26ca6
  1. 7
      ordr2/schemas/__init__.py

7
ordr2/schemas/__init__.py

@ -24,8 +24,11 @@ class CSRFSchema(colander.Schema): @@ -24,8 +24,11 @@ class CSRFSchema(colander.Schema):
)
@classmethod
def as_form(cls, request, url, **kw):
def as_form(cls, request, **kwargs):
url = kwargs.get('url', None)
if not url:
url = request.resource_url(request.context, request.view_name)
schema = cls().bind(request=request)
form = deform.Form(schema, action=url, **kw)
form = deform.Form(schema, action=url, **kwargs)
return form