[Zope] Yet another way to insert a variable from an expression

DA Loeffler David.Loeffler@bristol.ac.uk
Fri, 12 Jul 2002 15:57:21 +0100 (BST)

Sorry to spam the list with three consecutive messages. As I said, I am
an idiot. Anyway, the _logical_ way to do this, without using getattr()
which is excessive:

<dtml-var expr="_[id()+'.gif']" missing>

This is the _[prefix + '.suffix'] approach, but using the fact that id()
is a method and must be properly called - in an expr="" attribute, just
id will return a reference to the method, not call it. Otherwise we get
an "unsupported operand types for +" error, since you can't add a method
to a string!