Re: [Zope-dev] PythonMethods: Can't Slice context.REQUEST.PARENTS
The Doctor What writes:
... Now here is my next problem.
Using context.REQUEST.PARENTS doesn't give me the DTML Document that called me (so to speak).
I have: /test/new/foo_html
My PARENTS shows Zope, Test, and New, but doesn't show foo_html. "PARENTS" contain the objects from root up to but excluding the final object on the URL.
You may try to reference the final object by "this()". Dieter
* Dieter Maurer (dieter@handshake.de) [001112 17:12]:
The Doctor What writes:
... Now here is my next problem.
Using context.REQUEST.PARENTS doesn't give me the DTML Document that called me (so to speak).
I have: /test/new/foo_html
My PARENTS shows Zope, Test, and New, but doesn't show foo_html. "PARENTS" contain the objects from root up to but excluding the final object on the URL.
You may try to reference the final object by "this()".
Dieter, thanks for your help, but I'm unsure where to use it. Using context.this().id, self.this().id, m_self.this().id all get me the same things: Folder, Zope, and my method. None give me the DTML Document foo_html. This would seem to be an important thing. To re-iterate in a different way, it's the same as trying to do: <dtml-var id> in a DTML Method that is called by a DTML Document. You expect the id of the DTML Document that called you, not the Folder that the DTML Document resides in. Did you mean to do a this().id? That doesn't work at all, it gives me a Name Error. There *must* be a way to do this. Ciao! -- It has just been discovered that research causes cancer in rats. The Doctor What: A Holtje Production http://docwhat.gerf.org/ docwhat@gerf.org KF6VNC
From: The Doctor What <docwhat@gerf.org>
Using context.this().id, self.this().id, m_self.this().id all get me the same things: Folder, Zope, and my method. None give me the DTML Document foo_html.
This would seem to be an important thing.
The only information about your caller that you can get is the contents of their namespace. So, in the final release, you would be able to bind the caller's namespace to "_" and write _.this().id. That requires a change to Zope, though, so it doesn't work yet. You *could* work around this by explicitly passing the namespace (or this(), for that matter). Cheers, Evan @ digicool & 4-am
participants (3)
-
Dieter Maurer -
Evan Simpson -
The Doctor What