----- Original Message ----- From: "Andreas Jung" <andreas@andreas-jung.com> To: "Gilles Lenfant" <gilles@pilotsystems.net>; <zope@zope.org> Sent: Monday, July 28, 2003 3:42 PM Subject: Re: [Zope] Object
my general solution is something like that:
class foo:
def somemethod(self):
myattr = self.getmyattr()
def getmyattr(self): if not hasattr(self, '_v_myattr'): myattr = <do something to ...> else: myattr = getattr('_v_myattr'): return myattr
Thanks Andreas, I already done something like this that works, but I just wanted to know if this could be done when the object is extracted from the ZODB to the cache. Something more elegant like: def after_cache(self): self._v_mystuff = ... return Cheers --Gilles