[Zope3-checkins] SVN: zope.formlib/branches/4.0/ Add redirect status codes (303, 307) to the set which prevent form rendering.

Tres Seaver cvs-admin at zope.org
Tue Jun 26 13:30:27 UTC 2012


Log message for revision 127102:
  Add redirect status codes (303, 307) to the set which prevent form rendering.
  
  Fixes LP #1017884.
  
  Index: CHANGES.txt
  ===================================================================
  --- CHANGES.txt	(revision 127099)
  +++ CHANGES.txt	(working copy)
  @@ -2,6 +2,12 @@
   Changes
   =======
   
  +4.0.7 (unreleased)
  +==================
  +
  +- LP #1017884:  include extra redirect status codes (303, 307) to the
  +  set which prevent form rendering.
  +
   4.0.6 (2011-08-20)
   ==================
   
  

Changed:
  U   zope.formlib/branches/4.0/CHANGES.txt
  U   zope.formlib/branches/4.0/src/zope/formlib/form.py
  U   zope.formlib/branches/4.0/src/zope/formlib/tests/test_form.py

-=-
Modified: zope.formlib/branches/4.0/CHANGES.txt
===================================================================
--- zope.formlib/branches/4.0/CHANGES.txt	2012-06-26 13:25:40 UTC (rev 127101)
+++ zope.formlib/branches/4.0/CHANGES.txt	2012-06-26 13:30:23 UTC (rev 127102)
@@ -2,6 +2,12 @@
 Changes
 =======
 
+4.0.7 (unreleased)
+==================
+
+- LP #1017884:  Add redirect status codes (303, 307) to the set which prevent
+  form rendering.
+
 4.0.6 (2011-08-20)
 ==================
 

Modified: zope.formlib/branches/4.0/src/zope/formlib/form.py
===================================================================
--- zope.formlib/branches/4.0/src/zope/formlib/form.py	2012-06-26 13:25:40 UTC (rev 127101)
+++ zope.formlib/branches/4.0/src/zope/formlib/form.py	2012-06-26 13:30:23 UTC (rev 127102)
@@ -793,7 +793,7 @@
 
     def __call__(self):
         self.update()
-        if self.request.response.getStatus() in [301, 302]:
+        if self.request.response.getStatus() in [301, 302, 303, 307]:
             # Avoid rendering if the action caused a redirect.
             result = self.form_result or ''
         else:

Modified: zope.formlib/branches/4.0/src/zope/formlib/tests/test_form.py
===================================================================
--- zope.formlib/branches/4.0/src/zope/formlib/tests/test_form.py	2012-06-26 13:25:40 UTC (rev 127101)
+++ zope.formlib/branches/4.0/src/zope/formlib/tests/test_form.py	2012-06-26 13:30:23 UTC (rev 127102)
@@ -42,10 +42,10 @@
         return self._getTargetClass()(context, request)
 
     def test___call___does_not_render_on_redirects(self):
-        for status in (301, 302):
+        for status in (301, 302, 303, 307):
             request = self._makeRequest()
             request.response.setStatus(status)
-            def _raise(self, *args, **kw):
+            def _raise(*args, **kw):
                 self.fail("DON'T GO HERE")
             form = self._makeOne(request=request)
             form.form_fields = form.actions = ()



More information about the Zope3-Checkins mailing list