[Setup] Form prior redirection

Bastien Gauthier gbastien at commune.sambreville.be
Thu Mar 17 09:24:58 UTC 2011

If you do not add the "portal_url", you could have some problems if you url is actually "http://my_ip_address:8080/myplonesite", this would redirect to "http://my_ip_address:8080/my_form" wich is not the correct one...

What you wrote with the portal_url is wrong, that is why the "label" portal_url is added to your url...

Do this : 
<tal:redirect define="dummy python:request.RESPONSE.redirect(portal_url + '/forms/my_join_form')" />

This way, you are sure it will work in any cases... (well... :-))  Because the portal_url can change depending where you access it and it could have different formats...

Have a nice day,

BASTIEN Gauthier
Service Informatique - Administration Communale de Sambreville

>-----Message d'origine-----
>De : Denis Bitouzé [mailto:dbitouze at wanadoo.fr] 
>Envoyé : jeudi 17 mars 2011 10:19
>À : Bastien Gauthier
>Cc : setup at lists.plone.org
>Objet : Re: [Setup] Form prior redirection
>Le jeudi 17/03/11 à 09h29,
>"Bastien Gauthier" <gbastien at commune.sambreville.be> a écrit :
>> In fact, while doing
>> metal:use-macro="here/main_template/macros/master", you will 
>have some 
>> default value that come from the global_defines called in the 
>> main_template.  Well, to be short, doing this will give you some 
>> default value like "portal", "portal_url", "IsAnon", ...  
>You can see 
>> all these values in 
>"Products/CMFPlone/browser/ploneview.py".  You do 
>> not need to "calculate" these values...
>OK, thanks.
>> In the template I proposed you, you could even do "portal_url"
>> instead of "portal.absolute_url()" ...
>Directly in the python part, like the following one?
><tal:redirect define="dummy python:
>request.RESPONSE.redirect('portal_url/forms/my_join_form')" />
>It seems to work, but leads to an odd URL:
>This makes me realize that
><tal:redirect define="dummy python:
>request.RESPONSE.redirect('/forms/my_join_form')" />
>(without any 'portal URL') also works, leading to the expected:

More information about the Setup mailing list