[edit controller] add form to pre_web_edit signature to ease linkto usage (used by vcsfile cube)
authorFlorent Cayré <florent.cayre@gmail.com>
Thu, 13 Oct 2011 09:15:16 +0200
changeset 7942 d12c21ea4cd4
parent 7940 ac8052334e0d
child 7943 ad0581296e2c
[edit controller] add form to pre_web_edit signature to ease linkto usage (used by vcsfile cube)
web/views/editcontroller.py
--- a/web/views/editcontroller.py	Wed Oct 12 19:06:15 2011 +0200
+++ b/web/views/editcontroller.py	Thu Oct 13 09:15:16 2011 +0200
@@ -47,7 +47,7 @@
         return str(self.entity.e_schema).lower(), {}
 
     @implements_adapter_compat('IEditControl')
-    def pre_web_edit(self):
+    def pre_web_edit(self, form):
         """callback called by the web editcontroller when an entity will be
         created/modified, to let a chance to do some entity specific stuff.
 
@@ -173,13 +173,6 @@
         entity = self._cw.vreg['etypes'].etype_class(etype)(self._cw)
         entity.eid = valerror_eid(formparams['eid'])
         is_main_entity = self._cw.form.get('__maineid') == formparams['eid']
-        # let a chance to do some entity specific stuff
-        entity.cw_adapt_to('IEditControl').pre_web_edit()
-        # create a rql query from parameters
-        rqlquery = RqlQuery()
-        # process inlined relations at the same time as attributes
-        # this will generate less rql queries and might be useful in
-        # a few dark corners
         if is_main_entity:
             formid = self._cw.form.get('__form_id', 'edition')
         else:
@@ -187,6 +180,13 @@
             # inbetween, use cubicweb standard formid for inlined forms
             formid = 'edition'
         form = self._cw.vreg['forms'].select(formid, self._cw, entity=entity)
+        # let a chance to do some entity specific stuff
+        entity.cw_adapt_to('IEditControl').pre_web_edit(form)
+        # create a rql query from parameters
+        rqlquery = RqlQuery()
+        # process inlined relations at the same time as attributes
+        # this will generate less rql queries and might be useful in
+        # a few dark corners
         eid = form.actual_eid(entity.eid)
         try:
             editedfields = formparams['_cw_entity_fields']