Steve, If the attribute is immutable, just define it as a 'class' variable, rather than in the constructor. e.g., class Foo(.. ): newAttribute = 'hello?' You can of course *change* it in the constructor for new object, but all your old objects will just use the class variable. If it's mutable.. then you need to fix it in __setstate__(). -steve
"Steve" == Steve Alexander <steve@cat-box.net> writes:
Steve> Hi folks, I have a Python Product that I'm Steve> developing. During the course of development, I want to add Steve> a new attribute. All new instances get this attribute, as Steve> it is defined with a default value in the constructor. Steve> In addition, all instances that get edited via the web get Steve> the attribute, as the edit-processing method is defined to Steve> have a default value for this attribute. Steve> Is there any way of interacting with the ZODB persistence Steve> machinery to add the default attribute to all instances as Steve> they are brought out of persistent storage -- so that I can Steve> just restart Zope, and have all of my instances updated as Steve> I use them ? Steve> I can't find the right method or whatever in the ZODB Steve> on-line docs, or in the source. Steve> Thanks for any help. Steve> -- Steve Alexander Software Engineer Cat-Box limited Steve> http://www.cat-box.net Steve> _______________________________________________ Zope-Dev Steve> maillist - Zope-Dev@zope.org Steve> http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Steve> posts or HTML encoding! ** (Related lists - Steve> http://lists.zope.org/mailman/listinfo/zope-announce Steve> http://lists.zope.org/mailman/listinfo/zope )