diff roundup/cgi/client.py @ 5166:232c74973a56

issue1408570: fix that form values are lost .. on edit exceptions. This occured for example if editing an issue with the classic template and setting 'superseder' to a non-existing issue number. All changes to the form where the original field was non-empty were lost.
author Ralf Schlatterbeck <rsc@runtux.com>
date Mon, 22 Aug 2016 22:19:48 +0200
parents a86860224d80
children 349bef975367
line wrap: on
line diff
--- a/roundup/cgi/client.py	Mon Aug 15 20:53:37 2016 -0400
+++ b/roundup/cgi/client.py	Mon Aug 22 22:19:48 2016 +0200
@@ -295,6 +295,10 @@
         self.env = env
         self.setTranslator(translator)
         self.mailer = Mailer(instance.config)
+        # If True the form contents wins over the database contents when
+        # rendering html properties. This is set when an error occurs so
+        # that we don't lose submitted form contents.
+        self.form_wins = False
 
         # save off the path
         self.path = env['PATH_INFO']
@@ -421,6 +425,9 @@
 
     def add_error_message(self, msg, escape=True):
         add_message(self._error_message, msg, escape)
+        # Want to interpret form values when rendering when an error
+        # occurred:
+        self.form_wins = True
 
     def inner_main(self):
         """Process a request.

Roundup Issue Tracker: http://roundup-tracker.org/