[Zope] Problem with _[xyz]

Jim Washington jwashin@vt.edu
Fri, 07 Jul 2000 14:09:24 -0400


Hi, Christian

Christian Zagrodnick wrote:
> 
> Hi all,
> 
> shouldn't <dtml-var xyz> and <dtml-var "_['xyz']"> return the same result?

if xyz is a simple variable, yes.
 
> Well - I don't know why but only the 1st is working.
> (top.German.ActualPages is a folder; tThisIs... is a dtml-method)
> 
> 1:
> <dtml-with "top.German.ActualPages">
> <dtml-var tThisIsTheXYZDocument>
> </dtml-with>
> 
> 2:
> <dtml-with "_['top.German.ActualPages']">
> <dtml-var tThisIsTheXYZDocument>
> </dtml-with>

I may be wrong on this, but if the dots indicate subobjects, you may
want to do this

as Python sequence syntax: "_['top']['German']['ActualPages']"

or as "_['top'][aLanguage]['ActualPages']" assuming aLanguage is a
variable which may be e.g., 'German'

I hope this is a helpful hint.

-- Jim Washington
 
> Of course I want to replace the 'top.German.ActualPages' with a variable...
> but since it doesn't work with a hardcoded string it'll not work with a
> variable.
> 
> Any hint?
> 
> Thanks