[Zope] "Dynamic" dtml-with

Dieter Maurer dieter@handshake.de
Tue, 12 Nov 2002 20:27:13 +0100


Roger Fisher writes:
 > Is there a syntax I can use to include another folder in my namespace, when
 > I wont know which folder until runtime?
 > 
 > For example, if I have similarly-named preferences for different customers
 > in folders CUST1 and CUST2, I would like to at run-time be able to do
 > something similar to:
 > 	<dtml-with "CurrentCustomerString">
 > to get the correct customer folder in my namespace.
You do it for "dtml-with" the same way you do it for "dtml-var".

        <dtml-with "_.getitem(CurrentCustomerString)"> ... </dtml-with>

When you use "_[CurrentCustomerString]", you have a good chance that
it will not work (it will not, whenever the object is callable).


Dieter