"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

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to