web/views/basecontrollers.py
changeset 3629 559cad62c786
parent 3589 a5432f99f2d9
parent 3608 5a46e68c3d3c
child 3659 993997b4b41d
--- a/web/views/basecontrollers.py	Wed Oct 07 12:38:30 2009 +0200
+++ b/web/views/basecontrollers.py	Fri Oct 09 16:39:26 2009 +0200
@@ -192,8 +192,6 @@
     except ValidationError, ex:
         return (False, _validation_error(req, ex), ctrl._edited_entity)
     except Redirect, ex:
-        if ctrl._edited_entity:
-            ctrl._edited_entity.complete()
         try:
             req.cnx.commit() # ValidationError may be raise on commit
         except ValidationError, ex:
@@ -203,6 +201,10 @@
             req.exception('unexpected error while validating form')
             return (False, req._(str(ex).decode('utf-8')), ctrl._edited_entity)
         else:
+            # complete entity: it can be used in js callbacks where we might
+            # want every possible information
+            if ctrl._edited_entity:
+                ctrl._edited_entity.complete()
             return (True, ex.location, ctrl._edited_entity)
     except Exception, ex:
         req.cnx.rollback()
@@ -554,7 +556,6 @@
         rql = 'Any X WHERE X eid in (%s)' % (','.join(eids))
         rset = self._cw.execute(rql)
         for entity in rset.entities():
-            entity.complete() # XXX really?
             yield entity
 
     @property