[Zope-CMF] Re: [Zope] CMF reconfiguration error

Shane Hathaway shane@digicool.com
Tue, 03 Apr 2001 22:39:08 -0400


Tres Seaver wrote:
> 
> Jeff Senn wrote:
> >
> > [on the Zope list] "Hans de Wit" <hw@scp.nl> writes:
> >
> > > I tried the CMF on a clean Zope 2.3.1 configuration. Everything went pretty good, except
> > > for the reconfiguration of the portal:
> > >
> > > Error Type: TypeError
> > > Error Value: expected integer key
> > >
> > > The traceback is in the end of this message.
> > >
> > > I am using a Windows machine, so the assumptions in the readme are not completely met:
> >
> > I have the same problem on a linux install (fresh Zope 2.3.1 and CMF 1.0).
> >
> > Help!
> 
> I can reproduce this problem.  The culprit is the "dtml-return"
> tag in CMFDefault/skins/control/reconfig.dtml.  This patch clears
> it right up (I've just checked it in):

You're sure this isn't a catalog bug?  I think we ought to figure out
how to reproduce this again then add some debugging code that reveals
what is being submitted to the catalog.

> 
> ------- begin patch ------------------
> Index: CMFDefault/skins/control/reconfig.dtml
> ===================================================================
> RCS file: /cvs-repository/CMF/CMFDefault/skins/control/reconfig.dtml,v
> retrieving revision 1.1
> diff -u -u -r1.1 reconfig.dtml
> --- CMFDefault/skins/control/reconfig.dtml      2001/02/23 14:24:09     1.1
> +++ CMFDefault/skins/control/reconfig.dtml      2001/04/04 00:59:33
> @@ -1,2 +1,3 @@
>  <dtml-call expr="portal_properties.editProperties(REQUEST)">
> -<dtml-return expr="reconfig_form(_.None, _, portal_status_message='Settings changed')">
> +<dtml-call expr="REQUEST['RESPONSE'].redirect( portal_url()
> +                  + '/reconfig_form?portal_status_message=Settings+changed.')"
> 
> -------- end patch -------------------
> 
> That said, I would like to declare jihad against the use of "dtml-return"
> as a quasi-optimization to avoid a second trip on the wire:
> 
>  * It causes the URL bar to lie about the actual method producing
>    the response;
> 
>  * It yields bizarre error cases, which never show up in the logically
>    equivalent redirect.

Redirections also have their downsides, which I consider worse than your
list. :-)

- Methods that always redirect can mask exceptions that occur after the
DTML or Python is finished, such as storage or conflict errors.

- Redirection complicates XML-RPC and SOAP clients.  (In fact, it can
make XML-RPC impossible.)

- Redirections used this way are an abuse of the HTTP protocol. 
Redirect was intended to be used for static resources that have moved. 
We should try our best to be standards compliant.

- Redirections can hurt WebDAV.  CookieCrumblers use redirections, but
on cmf.zope.org we had to disable redirection for this reason.

Shane