[Zope] Nested properties

Lars Heber Lars.Heber@t-systems.de
Sat, 27 Oct 2001 09:39:30 +0200


Hello, Zopistas,

I just had a (for me) fantastic enlightenment, and I wanted you to
participate.

Long time ago, I (like so many other people here around) wondered
whether it was possible to nest properties. I never solved the problem.
Now, I had the same problem again, and I found a very simple solution:

Say, we have two properties, prop1 and prop2, and I want to refer to
either of those two props in a document.
I want to determine to which I want to refer in a property of my
document. So I simply create a document property myDocProp (string) and
give it the value either prop1 or prop2. And here's the key: Instead of
referring to myDocProp by
<dtml-var myDocProp> do a simple
<dtml-var "_.getitem(myDocProp)">.

The only thing I still couldn't find out was how to put constant values
in the property myDocProp. I tried 'my constant value' and some other
things, didn't work. One non-optimal possibility could be to create a
second doc prop, which carries the static value and then refer to that
second doc prop from the first one.
Perhaps somebody has a better idea?

I would be happy about some feedback - perhaps this topic is even worth
a mini how-to?

Hope, I could help the community, and sorry, if that wasn't new anyway
to some of you, but I thought it could be useful to a few people, 'cause
I still remember how long I was looking for the solution for that simple
problem...

--
Lars Heber, mailto:Lars.Heber@t-systems.de

T-Systems, debis Systemhaus GEI GmbH, Geschaeftsstelle Sachsen