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

ÀÌ°ü¼ö kslee@plaza1.snu.ac.kr
Tue, 17 Aug 1999 13:34:19 +0900


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)