[Zope] AccessRule eats part of my URL
Kristian Thy
thy at 42.dk
Wed Jun 23 04:08:13 EDT 2010
Dear List,
I am trying to add an AccessRule to a folder so our friendly Monster
redirects people to the same object in another folder in the Zope root,
i.e. if people visit
https://myurl.invalid/foo/bar/baz
I would like them redirected to
https://myurl.invalid/quux/bar/baz
I have a added a "Script (Python)" object to my foo folder that looks
like this:
from zExceptions import Redirect
moved = '%s?%s' % (context.REQUEST['URL'].replace('foo', 'quux'), context.REQUEST['QUERY_STRING'])
raise Redirect, moved
Then I have set an access rule on the folder by adding a "Set Access
Rule" object through the ZMI which points to the script object. My
access rule fires as expected, but anything after the foo is dropped.
That is,
https://myurl.invalid/foo/bar/baz
redirects to
https://myurl.invalid/quux?
while
https://myurl.invalid/foo/bar/baz?parm=val
redirects to
https://myurl.invalid/quux?parm=val
How can I make it pick up the right object? Testing
context.REQUEST['URL'] outside of an access rule looks like it should
work, but apparently the access rule eats part of the URL.
The only documentation I have been able to conjure up is
http://wiki.zope.org/zope2/SiteAccess which doesn't help much. I have
also tried to make sense of the code in VirtualHostMonster.py but I'm
afraid the whole map-and-stack thing is a bit beyond me.
Environment: SiteAccess-2.0.0, Zope-2.9.8 with python 2.4.2 on SUSE.
\\kristian
--
... et nemo ex vobis interrogat me: »Quo vadis?«
More information about the Zope
mailing list