[Zope] How to access Zope root in Script (Python)
Clemens Robbenhaar
zope@zope.org
Wed, 27 Nov 2002 00:13:42 +0100
Hi Jon,
> How do I refer to the root Zope directory within a Python script?
From file system level code one could just say "context.getPhysicalRoot()",
but for some reason this is not allowed inside a Script. Maybe this is
due to security restrictions this people cannot mess with the Zope root
if they do only have permissions for some nested folders.
You could try:
1. use an External Method as a helper, which calls getPhysicalRoot()
on the file system level.
2. use 'restrictedTraverse':
root = container.restrictedTraverse('/')
The second one is possibly the simpler way to do it.
cheers,
clemens