use a close_form method for consistency w/ open_form and allow overriding stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 15 Feb 2010 15:11:49 +0100
branchstable
changeset 4573 fc6bb020e60e
parent 4572 9e0a86d3ba62
child 4574 2380444d982c
use a close_form method for consistency w/ open_form and allow overriding
web/views/formrenderers.py
--- a/web/views/formrenderers.py	Mon Feb 15 15:11:18 2010 +0100
+++ b/web/views/formrenderers.py	Mon Feb 15 15:11:49 2010 +0100
@@ -92,7 +92,7 @@
         self.render_fields(w, form, values)
         self.render_buttons(w, form)
         w(u'</fieldset>')
-        w(u'</form>')
+        w(self.close_form(form, values))
         errormsg = self.error_message(form)
         if errormsg:
             data.insert(0, errormsg)
@@ -171,6 +171,13 @@
             tag += ' cubicweb:target="%s"' % xml_escape(form.cwtarget)
         return tag + '>'
 
+    def close_form(self, form, values):
+        """seem dump but important for consistency w/ close form, and necessary
+        for form renderers overriding open_form to use something else or more than
+        and <form>
+        """
+        return '</form>'
+
     def render_fields(self, w, form, values):
         fields = self._render_hidden_fields(w, form)
         if fields: