[3.10] renderer.render prototype bw compat
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 22 Oct 2010 13:09:09 +0200
changeset 6584 c4aa6186d3a3
parent 6583 4e7325d6b616
child 6586 207dc5111af2
[3.10] renderer.render prototype bw compat
web/views/forms.py
--- a/web/views/forms.py	Fri Oct 22 11:06:57 2010 +0200
+++ b/web/views/forms.py	Fri Oct 22 13:09:09 2010 +0200
@@ -50,6 +50,7 @@
 from logilab.common.deprecation import deprecated
 
 from cubicweb import typed_eid
+from cubicweb.utils import support_args
 from cubicweb.selectors import non_final_entity, match_kwargs, one_line_rset
 from cubicweb.web import uicfg, form, formwidgets as fwdgs
 from cubicweb.web.formfields import relvoc_unrelated, guess_field
@@ -179,7 +180,12 @@
         self.build_context(formvalues)
         if renderer is None:
             renderer = self.default_renderer()
-        renderer.render(w, self, kwargs)
+        if support_args(renderer.render, 'w'):
+            renderer.render(w, self, kwargs)
+        else:
+            warn('[3.10] you should add "w" as first argument o %s.render()'
+                 % renderer.__class__, DeprecationWarning)
+            w(renderer.render(self, kwargs))
         if data is not None:
             return '\n'.join(data)