[Zope] Access to objects hier up in the tree (parents)
Jim Fulton
jim@digicool.com
Mon, 09 Aug 1999 09:00:56 -0400
Heiko Stoermer wrote:
>
> How can I access parent objects (and their methods), preferrably
> starting at some toplevel folder?
>
> E.g.
> my DTML Method lives in /1/1.1/1.1.1/obj
> from obj I need to call, or access, or whatever, some SQL-Query that's
> in /1/1.2/sql_meth
> 1
> |_1.1
> | |_1.1.1
> | |_obj
> |_1.2
> |_sql_meth
>
> I think it must be done with namespaces but I don't get it. Additionally
> I would like to avoid relative addressing (such as ../../../../ ) but
> rather start at the top level.
If the actual names are like what you have above, then you could
use:
<!--#in "_['1.2'].sql_method()"--> ...
That is, you acquire '1.2' and invole it's 'sql_method' method.
If you had names like:
A
|_A_A
| |_A_A_A
| |_obj
|_A_B
|_sql_meth
it would be a little prettier:
<!--#in "A_B.sql_method()"--> ...
Jim
--
Jim Fulton mailto:jim@digicool.com Python Powered!
Technical Director (888) 344-4332 http://www.python.org
Digital Creations http://www.digicool.com http://www.zope.org
Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission. Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.