[request] Make sure set_message() actually displays its given message (closes #3003425)
authorRémi Cardona <remi.cardona@logilab.fr>
Thu, 31 Oct 2013 16:12:37 +0100
changeset 9561 3bdf85279c67
parent 9557 a3c075fe9385
child 9562 0509880fec01
[request] Make sure set_message() actually displays its given message (closes #3003425) The default automatic form sets a standard submit message as session data. However in some cases, such as the cancellation of a form edition, another message is intended to be printed on-screen. This patch makes sure that set_message() really scrubs all previous messages (and ids) from the request object and from the session data.
web/request.py
--- a/web/request.py	Tue Feb 18 13:54:08 2014 +0100
+++ b/web/request.py	Thu Oct 31 16:12:37 2013 +0100
@@ -318,6 +318,7 @@
 
     def set_message(self, msg):
         assert isinstance(msg, unicode)
+        self.reset_message()
         self._msg = msg
 
     def set_message_id(self, msgid):
@@ -348,6 +349,7 @@
         if hasattr(self, '_msg'):
             del self._msg
         if hasattr(self, '_msgid'):
+            self.session.data.pop(self._msgid, u'')
             del self._msgid
 
     def update_search_state(self):