ease overriding of default renderer tls-sprint
authorGraziella Toutoungis <graziella.toutoungis@logilab.fr>
Tue, 05 May 2009 16:53:12 +0200
branchtls-sprint
changeset 1686 32cb9f563fc6
parent 1685 3c59ae0e6548
child 1688 1f16db872f92
ease overriding of default renderer
web/form.py
--- a/web/form.py	Tue May 05 16:52:44 2009 +0200
+++ b/web/form.py	Tue May 05 16:53:12 2009 +0200
@@ -20,7 +20,7 @@
 from cubicweb.web.controller import NAV_FORM_PARAMETERS
 from cubicweb.web.formfields import (Field, StringField, RelationField,
                                      HiddenInitialValueField)
-from cubicweb.web.formrenderers import FormRenderer
+from cubicweb.web import formrenderers
 from cubicweb.web import formwidgets as fwdgs
 
 class FormViewMixIn(object):
@@ -220,6 +220,7 @@
     __registry__ = 'forms'
     __select__ = yes()
 
+    renderer_cls = formrenderers.FormRenderer
     is_subform = False
 
     # attributes overrideable through __init__
@@ -319,7 +320,7 @@
         """render this form, using the renderer given in args or the default
         FormRenderer()
         """
-        renderer = values.pop('renderer', FormRenderer())
+        renderer = values.pop('renderer', self.renderer_cls())
         return renderer.render(self, values)
 
     def form_build_context(self, rendervalues=None):