[Zope] object property which has name defined in variable

Jaroslav Lukesh lukesh at seznam.cz
Tue Nov 18 15:47:25 EST 2003


> Odesílatel: J. Cameron Cooper <jccooper at jcameroncooper.com>
> >It is unbelievable, but I does not know how to show title property from
> >object defined in variable like this example:
> >
> ><dtml-let picture="'z4_03_2.jpg'">
> >	<dtml-var "_['picture'].title">
> ></dtml-let>
> >
> >It returns <built-in method title of string object at 02EB8730>
> >
> >but
> >	<dtml-var "_['z4_03_2.jpg'].title">
> >returns real title from object named z4_03_2.jpg.
> >
> Watch your syntax! In example 1 you assign a string to a variable 
> 'picture' and then ask for the title of the variable named 'picture' (a 
> string), which obviously doesn't work.
> 
> Drop the single quotes and you'll assign an instance rather than a
string.

Many thanks and very sorry for that basic question. But in yesterday I was
try many combinations and always does not work as expected or generate Zope
error, and today it works like a charm not only with showed example.

Sincerelly,

J. Lukesh




More information about the Zope mailing list