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? Peter
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
participants (2)
-
Dieter Maurer -
Peter Bengtsson