[Zope] __getitem__ method in ZClass?

Dieter Maurer dieter@handshake.de
Mon, 25 Feb 2002 22:50:36 +0100


Peter Bengtsson writes:
 > If this particular product was a python based one, I could easily add a def 
 > __getitem__(self, key) method to my class so that one would be able to go:
 > 
 > <dtml-var "MyProductClassInstance['somekey']">
 > 
 > In a ZClass I can't add a Python Script called __getitem__ because of the 
 > underscores.
 > Any solutions to this?
Derive your ZClass from a Python base class that redirects "__getitem__"
to something you can define in your ZClass.


Dieter