[Zope] DTML Doc and Python scripts and aq_parent
Chris Kratz
chris.kratz@vistashare.com
Thu, 29 Nov 2001 19:53:31 -0500
Hello all,
I'm trying to wrap my head around acquisition once again. Each time I think
I get it, another curve ball gets me. If anyone has any pointers I would
appreciate it.
I have the following structure:
Root
+ FolderA
+ Folder A1
DTML_Doc w "Really Nifty Title"
+ CommonStuff
+ PythonScript
inside of DTML_Doc, there are several lines of code that look something like
this:
<dtml-with CommonStuff>
<dtml-var PythonScript>
</dtml-with>
In the python script I have the following
print context.title # Prints 'PythonScript'
print context.aq_parent.title # Prints 'CommonStuff'
print context.aq_parent.aq_parent.title # Prints Folder A1 ???Huh???
I think I understand the reason you get FolderA1s title attribute because it
is the container of DTML_Doc and thus is the aq_parent of CommonStuff in the
namespace. But, then how does one pull attributes such as the title from
the caller which in this case is a DTML_Doc? How does one get a handle on
the object that called a script? Any ideas?
-Chris
------------------------------
Chris Kratz
chris.kratz@vistashare.com