fix: Prevent multi pass in restore_previous_post stable
authorAlain Leufroy <alain.leufroy@logilab.fr>
Thu, 04 Mar 2010 08:50:03 +0100
branchstable
changeset 4779 dce36da37d40
parent 4778 e0f2ca89123f
child 4780 58432e8e7dde
fix: Prevent multi pass in restore_previous_post by adding a conditional return add the top of the methode.
web/form.py
--- a/web/form.py	Thu Mar 04 08:48:51 2010 +0100
+++ b/web/form.py	Thu Mar 04 08:50:03 2010 +0100
@@ -186,6 +186,11 @@
         # deleting validation errors here breaks form reloading (errors are
         # no more available), they have to be deleted by application's publish
         # method on successful commit
+        if hasattr(self, '_form_previous_values'):
+            # XXX behaviour changed in 3.6.1, warn
+            warn('[3.6.1] restore_previous_post already called, remove this call',
+                 DeprecationWarning, stacklevel=2)
+            return
         forminfo = self._cw.get_session_data(sessionkey, pop=True)
         if forminfo:
             self._form_previous_values = forminfo['values']