Re: [Zope-dev] Site Access Rewrite Rule documentation?
On Sat, 3 Mar 2001, Evan Simpson wrote: > You've got it almost right, you just have to know that it's called a stack > because it's used that way by the publishing machinery. This means that the > names on the stack are always in *reverse* order of how they appear in a > URL; "stack[-1]" is the next name to be traversed, not "stack[0]". I guess stack to me doesn't automatically imply that method of usage . Anyway, your correction worked perfectly, of course. Thanks very much. --RDM ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Site Access Rewrite Rule documentation?
From: "R. David Murray " <[EMAIL PROTECTED]> > 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"... You've got it almost right, you just have to know that it's called a stack because it's used that way by the publishing machinery. This means that the names on the stack are always in *reverse* order of how they appear in a URL; "stack[-1]" is the next name to be traversed, not "stack[0]". As you inferred, changing the stack will change the publishing path, and your code, suitably adjusted, should do what you wanted. Something like this (in "/", not "/Books"): stack = context.REQUEST['TraversalRequestNameStack'] if len(stack) >=2 and stack[-1] == 'Books' and stack[-2][:6] != 'manage': stack[-1:] = ['marketItems', 'store'] Note that unless you need it to exist for some other reason, you don't even have to have an actual "/Books" Folder for this code to work, and you could leave out the 'manage' check. Cheers, Evan @ digicool & 4-am ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Site Access Rewrite Rule documentation?
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 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )