[Zope-dev] The Application object
Shane Hathaway
shane@digicool.com
Mon, 17 Jul 2000 14:03:37 -0400
"Jeff K. Hoffman" wrote:
> All of my efforts are progressing towards one goal: How do I upgrade
> existing instances of a ZClass? Since I could find no __setstate__ method
> for ZClasses, I re-wrote the containing class as a Python class and
> figured I could leverage __setstate__ there, instantiating the subordinate
> ZClasses when required.
>
> No such luck.
Okay, here's an interesting approach. I've been playing with __of__ a
lot lately, so why not see what else it can do? :-)
In your class that needs to be upgraded, add this method, modifying it
as needed:
def __of__(self, parent):
if (self.isNotUpgraded()):
self.performUpgrade()
return MyClass.inheritedAttribute('__of__')(self, parent)
When any user walks up to the object, you will have the opportunity to
perform the upgrade.
Shane