Hi, I want to get the QUERY_STRING, so I can use it for my <dtml-with> loop. I heard from Max that you can traverse Zope with a path from code directly. You have to use the restrictedTraverse() method.. Asuming that: QUERY_STRING='path/to/training' You can just do it like: <dtml-call "REQUEST.set('training', getPhysicalRoot().restrictedTraverse(QUERY_STRING))"> <dtml.with training> ... etc. But the getPhysicalRoot() method gives me a NameError: NameError: global name 'getPhysicalRoot' is not defined So I tried the following: <dtml-call "REQUEST.set('training', ROOT().restrictedTraverse(QUERY_STRING))"> Where ROOT is a Python Script in the Root of Zope that does the following: return container But 'training' now is an <Application instance at 91b6bf0>. Can anyone help me with this problem? Greetz Nico
Nico de Boer wrote:
I want to get the QUERY_STRING, so I can use it for my <dtml-with> loop. I heard from Max that you can traverse Zope with a path from code directly. You have to use the restrictedTraverse() method..
But the getPhysicalRoot() method gives me a NameError:
NameError: global name 'getPhysicalRoot' is not defined
It's a secutiry problem. From the docs: "getPhysicalRoot() Returns the top-level Zope Application object. Permission: Python only" So you need to write an external method which does it for you. def getObjByPath(self, path): return self.getPhysicalRoot().restrictedTraverse(path) regards Max M -- "Sorry I would Really Like To Help More On This Project, But Am To Busy Doing Paid Work On A Tight Deadline" Max M
participants (2)
-
Max M -
Nico de Boer