[Zope3-checkins] SVN: zope.formlib/trunk/ Add redirect status codes (303, 307) to the set which prevent form rendering.
Tres Seaver
cvs-admin at zope.org
Tue Jun 26 13:33:19 UTC 2012
Log message for revision 127103:
Add redirect status codes (303, 307) to the set which prevent form rendering.
Fixes LP #1017884.
Index: CHANGES.txt
===================================================================
--- CHANGES.txt (revision 126914)
+++ CHANGES.txt (working copy)
@@ -5,6 +5,9 @@
4.2.0 (unreleased)
==================
+- LP #1017884: Add redirect status codes (303, 307) to the set which prevent
+ form rendering.
+
- Replaced deprecated ``zope.component.adapts`` usage with equivalent
``zope.component.adapter`` decorator.
Changed:
U zope.formlib/trunk/CHANGES.txt
U zope.formlib/trunk/src/zope/formlib/form.py
U zope.formlib/trunk/src/zope/formlib/tests/test_form.py
-=-
Modified: zope.formlib/trunk/CHANGES.txt
===================================================================
--- zope.formlib/trunk/CHANGES.txt 2012-06-26 13:30:23 UTC (rev 127102)
+++ zope.formlib/trunk/CHANGES.txt 2012-06-26 13:33:16 UTC (rev 127103)
@@ -5,6 +5,9 @@
4.2.0 (unreleased)
==================
+- LP #1017884: Add redirect status codes (303, 307) to the set which prevent
+ form rendering.
+
- Replaced deprecated ``zope.component.adapts`` usage with equivalent
``zope.component.adapter`` decorator.
Modified: zope.formlib/trunk/src/zope/formlib/form.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/form.py 2012-06-26 13:30:23 UTC (rev 127102)
+++ zope.formlib/trunk/src/zope/formlib/form.py 2012-06-26 13:33:16 UTC (rev 127103)
@@ -810,7 +810,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/trunk/src/zope/formlib/tests/test_form.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_form.py 2012-06-26 13:30:23 UTC (rev 127102)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_form.py 2012-06-26 13:33:16 UTC (rev 127103)
@@ -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