[Zope] How can I examine an property of an object from the ot her object in the other tree?

TFE MMS JARVIS JOHN jarvis.sd082@ex.tel.co.jp
Tue, 17 Aug 1999 14:35:17 +0900


Hi.
Your DTML method in isTred, <!--#var "'english.'+ _.string.join(
_.string.split(URL0, '/')[4:], '.')+'.TR'" -->
returns a string.

You might want to try changing it to <!--#var "_['english.'+ _.string.join(
_.string.split(URL0, '/')[4:], '.')+'.TR']" -->
This will use the string generated as the lookup key into the namespace. 

HTH
--John Jarvis

> -----Original Message-----
> From:	kslee@plaza1.snu.ac.kr [SMTP:kslee@plaza1.snu.ac.kr]
> Sent:	Tuesday, August 17, 1999 1:34 PM
> To:	michel@digicool.com; zope@zope.org
> Subject:	RE: [Zope] How can I examine an property of an object from
> the other object in the other tree?
> 
> Forgive this nagging newbie.
> 
> But I am still at a loss and my question seems an eye-opening(at least
> partially) one for a newbie.
> 
> Michel Pelletier wrote:
> 
> > You want <!--#var isTRed-->  Quoting the var argument makes it be
> > evaluated as an expression.  Not quoting it makes Zope use it by name.
> > If you quote a DTML Method or Document, you must *call* it to get it to
> > render the document.  In this case however, refering to the document by
> > name will call the document for you: <!--#var isTRed-->
> 
> To restate my question,
> 
> The situation:
> <!--#var isTRed--> just gives the *string* english.members.test.docTest.TR
> when called in the 
> DTML Document /korean/members/test/docTest  not the *value* of
> english.members.test.docTest.TR (TR is a string property of docTest DTML
> Document).
> So, it does not work.
> 
> 
> Q0. Is there a way to force an evaluation of the string content of an
> variable?
> 
> Q1. <!--#var "isTRed"-->  gives me the source of isTRed method. Is this
> what you mean by "evaluated as an expression"?
> 
> Q2. If you mean using <!--#call --> tag by *call*, call tag gives nothing
> to the browser, doesn't  it?
> 
> Q3. <!--#var "isTRed()"--> gives the name error(Traceback is at the
> bottom), and it seems as expected since the valus of isTRed is just
> string.
> 
> Sorry for any vagueness in my writing. Reading/writing about naming,
> contents and behavior of OO system in English is far more difficult than I
> expected.
> 
> LEE Kwan Soo.
> 
> 
> 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: /korean/members/test/docTest)
>   File lib/python/OFS/DTMLDocument.py, line 213, in __call__
>     (Object: docTest)
>   File lib/python/OFS/DTMLDocument.py, line 209, in __call__
>     (Object: docTest)
>   File lib/python/DocumentTemplate/DT_String.py, line 513, in __call__
>     (Object: docTest)
>   File lib/python/DocumentTemplate/DT_Util.py, line 266, in eval
>     (Object: isTRed())
>   File <string>, line 0, in ?
>   File lib/python/OFS/DTMLMethod.py, line 147, in __call__
>     (Object: isTRed)
>   File lib/python/DocumentTemplate/DT_String.py, line 513, in __call__
>     (Object: isTRed)
>   File lib/python/DocumentTemplate/DT_Util.py, line 266, in eval
>     (Object: 'english.'+
> _.string.join(
> _.string.split(URL0, '/')[4:],
> '.')+'.TR')
>   File <string>, line 0, in ?
> NameError: (see above)
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )