[Zope] ZOPE REDIRECTION

Amos Latteier amos@aracnet.com
Wed, 10 Feb 1999 11:44:05 -0800


At 12:08 PM 2/10/99 -0600, Theodore Patrick wrote:

>How do you do a simple redirection in Zope<dtml>?
> 
>1. User requests a url like the following on Zope --> www.site.com
>     http://www.site.com/pid1/ <http://www.site.com/pid1/>
>store1/?go=http://www.store1.com/product12/index.html
> 
>2. Zope reacts by redirecting the user to -->
>http://www.store1.com/product12/ <http://www.store1.com/product12/>
>index.html
> 
>3. What is the method in Zope that redirects?

There's a couple ways to redirect. Ether raise a 'Redirect' exception or
use the RESPONSE.redirect method.

Here's how you might do it in DTML:

<!--#call "<!--#call "RESPONSE.redirect(BASE1+'/foo')"-->

this redirects to '/foo'. BASE1 is the URL up to and including the
scriptname, so adding it to '/foo' give you an absolute URL, which is
required for redirecting.

See the DTML user's guide for more information on BASEn variables, and
redirection.

In your case if you have the redirect URL as a variable named 'go', simply
use this:

<!--#call "RESPONSE.redirect(go)"-->

Good luck.

-Amos