[Zope] object property which has name defined in variable

J. Cameron Cooper jccooper at jcameroncooper.com
Mon Nov 17 16:21:30 EST 2003


Jaroslav Lukesh wrote:

>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.

             --jcc

-- 
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."





More information about the Zope mailing list