[Checkins] SVN: plone.z3cform/trunk/ Moved contents attribute in the update method. Removed the check redirection in the update method, you have to code a check in your form.render method to not do useless rendering like it's the case with _finishedAdd. Added a note to adapt code written with FormWrapper and ViewletBase since version 0.5.8
Vincent Fretin
vincent.fretin at gmail.com
Tue Jan 26 03:57:00 EST 2010
Log message for revision 108504:
Moved contents attribute in the update method. Removed the check redirection in the update method, you have to code a check in your form.render method to not do useless rendering like it's the case with _finishedAdd. Added a note to adapt code written with FormWrapper and ViewletBase since version 0.5.8
Changed:
U plone.z3cform/trunk/docs/HISTORY.txt
U plone.z3cform/trunk/plone/z3cform/layout.py
-=-
Modified: plone.z3cform/trunk/docs/HISTORY.txt
===================================================================
--- plone.z3cform/trunk/docs/HISTORY.txt 2010-01-26 04:25:51 UTC (rev 108503)
+++ plone.z3cform/trunk/docs/HISTORY.txt 2010-01-26 08:56:59 UTC (rev 108504)
@@ -8,7 +8,7 @@
So we have to render the form to see if we have a redirection.
In the case of redirection, we don't render the layout at all.
This version remove the contents method on FormWrapper,
- it's now an attribute.
+ it's now an attribute set during the FormWrapper.update.
This change fixes status message not shown because it was consumed by
the never shown rendered form.
[vincentfretin]
@@ -24,6 +24,8 @@
* Don't do the rendering if there is a redirection, use the update/render
pattern for that.
+ See http://dev.plone.org/plone/ticket/10022 for an example how
+ to adapt your code, in particular if you used FormWrapper with ViewletBase.
[vincentfretin]
0.5.7 - 2009-11-17
Modified: plone.z3cform/trunk/plone/z3cform/layout.py
===================================================================
--- plone.z3cform/trunk/plone/z3cform/layout.py 2010-01-26 04:25:51 UTC (rev 108503)
+++ plone.z3cform/trunk/plone/z3cform/layout.py 2010-01-26 08:56:59 UTC (rev 108504)
@@ -48,14 +48,16 @@
"""
z2.switch_on(self, request_layer=self.request_layer)
self.form_instance.update()
+ # A z3c.form.form.AddForm do a redirect in its render method.
+ # So we have to render the form to see if we have a redirection.
+ # In the case of redirection, we don't render the layout at all.
+ self.contents = self.form_instance.render()
def __call__(self):
"""We use the update/render pattern. If a redirect happens in the
meantime, we simply skip the rendering.
"""
self.update()
- if self.request.response.getStatus() in (302, 303):
- return u""
return self.render()
def render(self):
@@ -67,10 +69,6 @@
directive. If no index template is set, we look up a an adapter from
(self, request) to IPageTemplate and use that instead.
"""
- # A z3c.form.form.AddForm do a redirect in its render method.
- # So we have to render the form to see if we have a redirection.
- # In the case of redirection, we don't render the layout at all.
- self.contents = self.form_instance.render()
if self.request.response.getStatus() in (302, 303):
return u""
if self.index is None:
More information about the checkins
mailing list