[Zope] redirect strangeness ...
Oliver Bleutgen
myzope@gmx.net
Mon, 26 Aug 2002 19:04:42 +0200
Dennis Allison wrote:
> This dtml fragment fails strangely ---
>
> <dtml-var standard_header_html>
> <dtml-if expr=pythonscript()>
> <dtml-call expr="REQUEST['RESPONSE'].redirect('index_html')">
> <dtml-else>
> <dtml-call expr="REQUEST['RESPONSE'].redirect('originalform?'+marshallformvars())">
> </dtml-if>
> <dtml-var standard_footer_html>
>
> The pythonscript() validates the form variables. marshallformvars()
> is a python script that returns the appropriately quoted name/value pairs.
>
> The observed behavior is strange. If the pythonscript() returns 0, the
> transfer to the originalform occurs along with the diagnostic information
> inserted by the validation script. This is the behavior I expect.
>
> But when the pythonscript() returns 1, I get a Zope error indicating
> that the sytem cannot find, not index_html but
>
> /aaa/bbb/ccc/ddd/%3A
>
> Both the index_html and the failing dtml-method are in the folder
> referenced via the path /aaa/bbb/ccc/ddd.
>
> As a workaround I replaced the first redirect with a <dtml-var index_html>
> but I do wonder why the initial approach failed. Insight appreciated.
To debug this problem, you might want to use the nice tcpwatch (->
google). It acts as a proxy but displays the complete http conversation
in a window.
Another remark to your redirects, AFAIK the the rfc mandates to redirect
to complete URLs, not just the relative link. I don't know offhand if
zope "fixes" you redirect, but I would use something like
absolute_url()+'/index_html' as a target instead.
cheers,
oliver