| |
Creating 'mythical' symlinks in zope
Submitted by: ivo
Last Edited: 2004-10-14
Category: Python(Script)
|
| Average rating is:
4.75 out of 5
|
(4 ratings) |
|
Description:
This little 'trick' allows you to delegate requests to a certain
object (called, for example, 'link'), elsewhere in your zopeserver.
I.e. you can make /foo/bar/link point to /blah/duh, requesting
/foo/bar/link/this/that will result in /blah/duh/this/that,
where 'that' will acquire stuff from /foo/bar as well.
|
Source (Text):
from string import split,join
REQUEST = container.REQUEST
stack = REQUEST['TraversalRequestNameStack']
add_path = filter(None, split(context.link_to, '/'))
add_path.reverse()
stack.extend(add_path)
|
Explanation:
Create a folder called 'link'. Give this folder a property
'link_to', which points to the destination object, i.e.
/blah/duh.
In this folder, create a python script (call it anything, i.e. 'go')
with the sourcecode shown above. Make this script an Access Rule
by selecting this in your product dropdown list.
That's it!
If you ever want to manage the link folder, insert '_SUPPRESS_ACCESSRULE' in the url, i.e. /foo/bar/link/_SUPPRESS_ACCESSRULE/manage
|
Comments:
No Comments
|
|