[Zope-dev] Site Access Rewrite Rule documentation?

R. David Murray bitz@bitdance.com
Sat, 3 Mar 2001 17:50:36 -0500 (EST)


Is there any real documentation for Site Access rewrite rules anywhere?
There isn't anything in the help system of 2.3.1b1, and the docs under
SiteAccess on zope.org have a couple of examples but no technical
explanation of how the parts of the example interact with Zope.

My goal is pretty simple.  I have a Specialist under /store/marketItems.
I want my content managers to be able to use URLs like:

/Books/someisbnnumber

to refer to the object that is really at:

/store/marketItems/someisbnnumber

I could use a redirect, but why suffer the transaction overhead?  I figured
I could have a folder Books with an access rule like this:

stack = context.REQUEST['TraversalRequestNameStack']
if stack[0]=='Books' and (len(stack)==1 or stack[1][:6]=='manage'):
	stack[0:1] = ['store','marketItems']

I figured I needed the manage thing so that I could edit the access rule.

When I try to use this, no rewriting appears to happen.

So I changed it to:

if not stack[0][:6]=='manage':
	stack[0:1] = ['store','marketItems']

This didn't do anything for the URL '/Books', and gave me a notfound
error on /Books/marketItems if I put something after the /Books.
Changing it to stack[1:1] gives me a list index out of range.  I can't
figure out where *that* would be coming from.

So, clearly I don't have a clue what stack is supposed to contain or
what changing it does.  Can anyone point me to docs or give me some
help?  You can also tell me, "that's stupid, just solve your problem
this way"...

--RDM