[Zope] simple var

Oleg Broytmann Oleg Broytmann <phd@phd.pp.ru>
Sat, 15 Jun 2002 02:40:36 +0400


On Fri, Jun 14, 2002 at 09:14:21PM +0200, Paul Zwarts wrote:
> <dtml-var "_[sName'].index_html">
> 
> Based on responses from Jim and Oleg, this doesn't work past the first
> iteration ('something'.index_html) because anything that is
> something.something is really rendered as 'something.something' rather
> than 'something' . 'something'...

   Tthen split the string yourself and traverse the path! Something like
this:

attr_list = "some1.some2".split('.')
object = _.getitem(attr_list[0])
for attr in attr_list[1:]:
   object = object.getitem(attr)

Understand?

Oleg.
-- 
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.