[Zope] Problem with ZClass methods
Jay, Dylan
djay@lucent.com
Fri, 8 Oct 1999 14:13:39 +1000
I want to cache the results of a ZClass method in the ZCatalog record. This
should theoretocally work fine as ZCatalog will call callable meta-data
fields. However from looking at the code it will make a call such as
"classMethod()". Now my method is a DTML method that references other
methods of the same class. Calling it without arguments results in an
attribute not found exception as there is no context being passed into the
method.
Why do DTML methods not have a defualt context? Why can't I call
aClass.aMethod() and have it work correctly???
Basically I see 2 ways of fixing this problem.
a) let a call to aClass.aMethod() include a default basic context that will
allow references to resolve to its parents.
b) Have a self object that is active in a method even if there is no
context. This is a bit ugly because you have make sure every reference in a
method uses self.anotherMethod().