[Zope] Indirection, acquisition, asphyxiation

Dennis Nichols nichols@tradingconnections.com
Thu, 14 Sep 2000 18:47:06 -0500


I'm having trouble using the value of a property to determine which object 
to render (Zope 2.2.1, if it makes any difference). Starting from the 
beginning, let's say I have two folders A and B with four DTML methods 
(Nilo, Alpha, Smalpha, and Bravo):

/
    Nilo
    /A
       Alpha
       Smalpha
    /B
       Bravo

 From Alpha, I can render Nilo, Smalpha, and Bravo by using this dtml:

   <dtml-var Nilo>       (or <dtml-var "Nilo">)
   <dtml-var Smalpha>    (or <dtml-var "Smalpha">)
   <dtml-var "B.Bravo">  (not <dtml-var B.Bravo>!)

OK, now I want a property of folder A, call it 'choice', to determine what 
should be rendered by Alpha. So I rewrite Alpha to include:

   either <dtml-var "_[choice]">
       or <dtml-var "_.getitem(choice)">

These work nicely if I set 'choice' to 'Nilo' or 'Smalpha' but I don't see 
how to make either one work for Bravo! Setting 'choice' to 'B.Bravo' gives me:

Error Type: KeyError
Error Value: B.Bravo

How do I get this to work for Bravo (and still keep it working for the 
other cases)? Clearly my zen needs some tending to.

--
Dennis Nichols
nichols@tradingconnections.com