[Zope3-checkins] SVN: zope.formlib/trunk/src/zope/formlib/form.py we don't want to reset a form if we are not redrawing it.

Gary Poster gary at zope.com
Wed Sep 28 10:33:42 EDT 2005


Log message for revision 38665:
  we don't want to reset a form if we are not redrawing it.  
  
  Not only is 
  it a bit inefficient, but the redraw may be canceled because we can no 
  longer access the information to draw the form!
  

Changed:
  U   zope.formlib/trunk/src/zope/formlib/form.py

-=-
Modified: zope.formlib/trunk/src/zope/formlib/form.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/form.py	2005-09-28 12:48:20 UTC (rev 38664)
+++ zope.formlib/trunk/src/zope/formlib/form.py	2005-09-28 14:33:42 UTC (rev 38665)
@@ -724,14 +724,13 @@
         self.form_result = result 
 
     def render(self):
-        if self.form_reset:
-            # we reset, in case data has changed in a way that
-            # causes the widgets to have different data
-            self.resetForm()
-            self.form_reset = False
-            
-        # if the form has been updated, it will already have a reult
+        # if the form has been updated, it will already have a result
         if self.form_result is None:
+            if self.form_reset:
+                # we reset, in case data has changed in a way that
+                # causes the widgets to have different data
+                self.resetForm()
+                self.form_reset = False
             self.form_result = self.template()
 
         return self.form_result



More information about the Zope3-Checkins mailing list