[Zope] DTML equiv of eval (again).

chas panda@skinnyhippo.com
Sun, 03 Oct 1999 16:14:22 +0800


>> But this does not :
>> <dtml-var "_['Images.img' +  x]">
>
>This would find a single object which has Id ('Images.img'+x). 

Aaaah, as opposed to the object with Id ('img' + x) which 
exists within the folder 'Images'. 

So, that also explains why :
<dtml-with "Imports">
      <dtml-var "_['Method' + 'X']">
</dtml-with>

is equivalent to :
<dtml-var "Imports.MethodX(_.None, _)">

But why this won't work :
<dtml-var "_['Imports.Method' + 'X']">
 
 This latter example tripped me up for 2 hours as I played 
 with various combinations such as :
 - <dtml-var "_['Imports.Method' + 'X()']"> to 
 - <dtml-var "_['Imports.Method' + 'X(_.None, _)']"> 
 - etc


> <dtml-with Images><dtml-var>"_['img'+x]"></dtml-with>

Yep, that's what I finally worked out through trial and error. 
Being the stubborn pig cost me the extra hours because I don't 
like just accepting things, I want to know why. It also seems
that this is likely to trip many people up since it is not
consistent with one's ability to write this :

<dtml-var "Images.imgDog"> 

or 

<dtml-var "Imports.MethodName(_.None, _)">

which do NOT refer to singular items with ID's 'Images.imgDog'
and 'Imports.MethodName' respectively.

In fact, this doesn't look very consistent to me. And *this* is the 
sort of stuff that really needs to be explained in foolproof, layman
terms.

Anyway, thanks big time Evan, at least my earlier problems have an
explanation for them - I hate getting things to work and not knowing
why.

chas

ps. returning to my comments in reply to Picasso's mail, how 
    would/should I have debugged this properly then ?  I'm relying 
    on the Force a bit too much at the moment.