[Zope3-dev] class lifecycle management/missing attributes

Garrett Smith garrett@mojave-corp.com
Tue, 1 Jul 2003 18:24:52 -0500


Is there an example in the Zope 3 code that illustrates a solution to
the following problem:

1 - A component of class Foo is created in the ZODB.

2 - Class Foo is modified, adding a new attribute in __init__:

    def __init__(self):
      self.bar =3D 'some_default'

3 - The component in the ZODB doesn't have bar -- bad.

How would one add bar to instances of Foo already serialized? In other
apps, I've handled this by adding the missing attribute in a deserialize
method.

I assume there's a pattern for this, but haven't spotted anything in the
source.

 -- Garrett