[form] make EntityFormRenderer a little bit easier to override stable
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Tue, 29 Sep 2009 09:22:14 +0200
branchstable
changeset 3507 ff945c7013d9
parent 3506 f0ec5d17f470
child 3509 711cff0a83dd
[form] make EntityFormRenderer a little bit easier to override
web/views/formrenderers.py
--- a/web/views/formrenderers.py	Mon Sep 28 18:58:12 2009 +0200
+++ b/web/views/formrenderers.py	Tue Sep 29 09:22:14 2009 +0200
@@ -371,16 +371,19 @@
     # needs some additional points in some case (XXX explain cases)
     __select__ = EntityBaseFormRenderer.__select__ & yes()
 
-    _options = FormRenderer._options + ('display_relations_form',)
+    _options = FormRenderer._options + ('display_relations_form', 'main_form_title')
     display_relations_form = True
+    main_form_title = _('main information')
 
     def render(self, form, values):
         rendered = super(EntityFormRenderer, self).render(form, values)
         return rendered + u'</div>' # close extra div introducted by open_form
 
     def open_form(self, form, values):
-        attrs_fs_label = ('<div class="iformTitle"><span>%s</span></div>'
-                          % self.req._('main informations'))
+        attrs_fs_label = ''
+        if self.main_form_title:
+            attrs_fs_label += ('<div class="iformTitle"><span>%s</span></div>'
+                               % self.req._(self.main_form_title))
         attrs_fs_label += '<div class="formBody">'
         return attrs_fs_label + super(EntityFormRenderer, self).open_form(form, values)