web/views/editcontroller.py
changeset 7942 d12c21ea4cd4
parent 7584 e1881933f366
child 7990 a673d1d9a738
--- 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']