refactor to ease overriding tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 11 Mar 2009 19:54:03 +0100
branchtls-sprint
changeset 1073 e4342c74ed2d
parent 1072 e36f2889e1bd
child 1074 c07f3accf04a
refactor to ease overriding
web/form.py
--- a/web/form.py	Wed Mar 11 19:53:39 2009 +0100
+++ b/web/form.py	Wed Mar 11 19:54:03 2009 +0100
@@ -1191,21 +1191,26 @@
                 w(field.render(form, self))
                 fields.remove(field)
         if fields:
+            self._render_fields(fields, w, form, display_help)
+        for childform in getattr(form, 'forms', []):
+            self.render_fields(w, childform, values)
+            
+    def _render_fields(self, fields, w, form, display_help):
             w(u'<table>')
             for field in fields:
                 w(u'<tr>')
-                w('<th>%s</th>' % self.render_label(form, field))
+                w(u'<th>%s</th>' % self.render_label(form, field))
                 w(u'<td style="width:100%;">')
                 w(field.render(form, self))
                 if display_help == True:
                     w(self.render_help(form, field))
                 w(u'</td></tr>')
             w(u'</table>')
-        for childform in getattr(form, 'forms', []):
-            self.render_fields(w, childform, values)
-        
+
+    button_bar_class = u'formButtonBar'
+    
     def render_buttons(self, w, form):
-        w(u'<table class="formButtonBar">\n<tr>\n')
+        w(u'<table class="%s">\n<tr>\n' % self.button_bar_class)
         for button in form.form_buttons():
             w(u'<td>%s</td>\n' % button)
         w(u'</tr></table>')