From 44d5e26ca6b2341e903254af10834d70e9e486e6 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 27 Sep 2017 16:47:06 +0200 Subject: [PATCH] simplified form generation from schema --- ordr2/schemas/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ordr2/schemas/__init__.py b/ordr2/schemas/__init__.py index 4e6a6c1..e249e79 100644 --- a/ordr2/schemas/__init__.py +++ b/ordr2/schemas/__init__.py @@ -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