[Zope-dev] The Spanish Aquisition

Michel Pelletier michel@digicool.com
Wed, 10 Mar 1999 09:44:51 -0500


> -----Original Message-----
> From: Jason Spisak [mailto:webmaster@mtear.com]
> Sent: Tuesday, March 09, 1999 4:57 PM
> To: zope-dev@zope.org
> Subject: [Zope-dev] The Spanish Aquisition
> 
> 
> Zopistas,
> 
> I am trying to reference a property of a Folder that is in a totally
> spearate hirearchy of Zope. When inserted below the folder 
> Iwish to grab
> the property of it works fine, but when moves elsewhere it dies.
> 
> <!--#var standard_html_header-->
> <!--#var "_['candidate1'].name"-->
> <!--#var standard_html_footer-->
> 

Hmm.. I'm not sure I understand the problem you want to solve, but have
you tried:

<!--#var name-->

If the folder is one of your ancestors (ie above you and in your path)
you can just reference it's attributes like they were your own.  If the
folder you are targeting is above you but not in your path (ie not an
ancestor) but is a child of one of your ancestors, you must first aquire
the folder, and then reference it's property, like this:

<!--#var candidate1.name-->

The rule is:
If a folder is an ancestor of yours, you can just say <!--#var
propertyname-->
If a folder is a child of one of your ancestors, but not one of your
ancestors (like a cousin), you can say <!--#var
foldername.propertyname-->, because you must first aquire the folder.

Remember that when it comes to aquisition, DTML Methods and DTML
Documents behave differently.  Documents aquire from their perspective,
and Methods aquire from the perspective of the folder than contains them
(Note: see the ZDP FAQ entry on the difference between Methods and
Documents).


-Michel

> name is the property, and candidate1 is the folder id.
> 
> I have tried _.namespace and the #with and #in tags, all have the same
> problem.
> 
> Here is the traceback
> 
> <!--
> Traceback (innermost last):
>   File lib/python/ZPublisher/Publish.py, line 877, in publish_module
>   File lib/python/ZPublisher/Publish.py, line 590, in publish
>     (Info:
> /staff/companies/company1/job_order1/submission1/job_order_exp)
>   File lib/python/OFS/DTMLMethod.py, line 155, in __call__
>     (Object: job_order_exp)
>   File lib/python/OFS/DTMLMethod.py, line 151, in __call__
>     (Object: job_order_exp)
>   File lib/python/DocumentTemplate/DT_String.py, line 513, in __call__
>     (Object: job_order_exp)
>   File lib/python/DocumentTemplate/DT_In.py, line 620, in renderwob
>     (Object: _['candidate1'])
>   File lib/python/DocumentTemplate/DT_Util.py, line 266, in eval
>     (Object: _['candidate1'])
>   File &lt;string&gt;, line 0, in ?
>   File lib/python/DocumentTemplate/DT_Util.py, line 150, in
> careful_getitem
> KeyError: (see above)
> 
> -->
> 
> Do I have to know the folder that separates the hirearchy and put that
> in somewhere?  
> 
> Zope-on!
> 
> Jason Spisak
> webmaster@mtear.com
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://www.zope.org/mailman/listinfo/zope-dev
> 
> (For non-developer, user-level issues, use the companion list,
> zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
>