[Zope] Redirect to a specific page

Danny William Adair danny@adair.net
Tue, 16 Oct 2001 09:42:13 +1300


Hi Konstantinos!

Maybe I didn't get it right, but if you ALWAYS want to redirect, no matter 
what, you would simply add an Access Rule holding the redirect (this time its 
not normal redirecting, you change the Traversal Path before it has actually 
been processed):

create a python script in your root folder holding this one line

context.REQUEST.set('TraversalRequestNameStack',['myObject','mySubFolder'])

and "Set Access Rule" (from the "Select type to add..." Menu, yes it's not a 
really appropriate place for it) to the id of this script (e.g. "access_rule")

This will always bring you to "YOUR_ZOPE_ROOT/mySubFolder/myObject". Keep in 
mind that the TraversalRequestNameStack holds the objects to process in 
reverse order.

For more information on Access Rules, see
http://www.zope.org/Members/4am/SiteAccess2

If your Zope version is 2.3 or higher, the SiteAccess product is built in, on 
older versions you will have to install it first. After the installation you 
will be able to add "SiteRoot" objects and "Set Access Rule".

hth,
Danny


On Tuesday 16 October 2001 08:39, Konstantinos Margaritis wrote:
>   Hi,
>   Is it possible to redirect to a specific page no matter what the user
> asks for? I mean the browser could request the url
>
> http://foo.bar.com/luser and I would redirect it to
> http://foo.bar.com/template?username=luser
>
> The problem is that when I request a URL that doesn't exist it reports a
> 'Not found' error.