replace set_error_url/set_dom_id by a single mainform argument
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 05 Jun 2009 10:03:16 +0200
changeset 2048 5e4d1433b90b
parent 2046 8fce2d25853c
child 2049 b9baedffeb8b
replace set_error_url/set_dom_id by a single mainform argument
web/views/cwproperties.py
web/views/editforms.py
web/views/forms.py
web/views/management.py
--- a/web/views/cwproperties.py	Fri Jun 05 09:13:49 2009 +0200
+++ b/web/views/cwproperties.py	Fri Jun 05 10:03:16 2009 +0200
@@ -212,7 +212,7 @@
         else:
             label = key
         subform = self.vreg.select_object('forms', 'base', self.req, entity=entity,
-                                     set_error_url=False, set_dom_id=False)
+                                     mainform=False)
         subform.append_field(PropertyValueField(name='value', label=label,
                                                 eidparam=True))
         subform.vreg = self.vreg
--- a/web/views/editforms.py	Fri Jun 05 09:13:49 2009 +0200
+++ b/web/views/editforms.py	Fri Jun 05 10:03:16 2009 +0200
@@ -71,7 +71,7 @@
                 continue
             done.add(entity.eid)
             subform = self.vreg.select_object('forms', 'base', req, entity=entity,
-                                              set_error_url=False, set_dom_id=False)
+                                              mainform=False)
             form.form_add_subform(subform)
             # don't use outofcontext view or any other that may contain inline edition form
             w(u'<li>%s</li>' % tags.a(entity.view('textoutofcontext'),
@@ -307,7 +307,7 @@
         for row in xrange(len(self.rset)):
             form = self.vreg.select_object('forms', 'edition', self.req, self.rset,
                                            row=row, attrcategories=('primary',),
-                                           set_error_url=False, set_dom_id=False)
+                                           mainform=False)
             # XXX rely on the EntityCompositeFormRenderer to put the eid input
             form.remove_field(form.field_by_name('eid'))
             self.form_add_subform(form)
@@ -356,7 +356,7 @@
         """fetch and render the form"""
         form = self.vreg.select_object('forms', 'edition', self.req, None,
                                        entity=entity, form_renderer_id='inline',
-                                       set_error_url=False, set_dom_id=False,
+                                       mainform=False,
                                        copy_nav_params=False)
         self.add_hiddens(form, entity, peid, rtype, role)
         divid = '%s-%s-%s' % (peid, rtype, entity.eid)
--- a/web/views/forms.py	Fri Jun 05 09:13:49 2009 +0200
+++ b/web/views/forms.py	Fri Jun 05 10:03:16 2009 +0200
@@ -36,13 +36,12 @@
     cssstyle = None
     cwtarget = None
     redirect_path = None
-    set_error_url = True
-    set_dom_id = True
     copy_nav_params = False
     form_buttons = None # form buttons (button widgets instances)
     form_renderer_id = 'default'
 
-    def __init__(self, req, rset=None, row=None, col=None, submitmsg=None,
+    def __init__(self, req, rset=None, row=None, col=None,
+                 submitmsg=None, mainform=True,
                  **kwargs):
         super(FieldsForm, self).__init__(req, rset, row=row, col=col)
         self.fields = list(self.__class__._fields_)
@@ -52,9 +51,8 @@
             else:
                 assert hasattr(self.__class__, key) and not key[0] == '_', key
                 setattr(self, key, val)
-        if self.set_error_url:
+        if mainform:
             self.form_add_hidden('__errorurl', self.session_key())
-        if self.set_dom_id:
             self.form_add_hidden('__domid', self.domid)
         if self.copy_nav_params:
             for param in NAV_FORM_PARAMETERS:
--- a/web/views/management.py	Fri Jun 05 09:13:49 2009 +0200
+++ b/web/views/management.py	Fri Jun 05 10:03:16 2009 +0200
@@ -243,7 +243,7 @@
         submitmail = self.config['submit-mail']
         if submiturl or submitmail:
             form = self.select_object('forms', 'base', self.req,
-                                      set_error_url=False, set_dom_id=False)
+                                      mainform=False)
             binfo = text_error_description(ex, excinfo, req, eversion, cversions)
             form.form_add_hidden('description', binfo)
             form.form_add_hidden('__bugreporting', '1')