On Mon, Aug 27, 2012 at 11:57:25PM +1200, Richard Shea wrote: > Hi - I've been looking at zope.generations > (http://pypi.python.org/pypi/zope.generations) - "Generations are a way > of updating objects in the database when the application schema > changes". > > My interest is for a standalone ZODB database. The example given on that > page seems to presume that generations will only ever be used within > Zope. It's a shame because it looks like a good facility.
I'm too tired to read that page and see where it creates that (false) impression. > My questions are : > > * Is zope.generations able to be used on a standalone ZODB database ? Yes. All you need to do is make sure the event subscriber is invoked when you open the database. In other words, once you open a DB connection, zope.event.notify(DatabaseOpenedEvent(...)), or at the very least invoke the evolveMinimumSubscriber() by hand. > * Are there other, similar, facilities which would track change to > application classes (or at least accept notifications of them) and > automatically 'fixup' the corresponding classes already in the > database ? I wouldn't call zope.generations automatic. You have to write evolution scripts by hand. Also, you have to understand ZODB really really well (e.g. avoid certain kinds of changes that are impossible to support even with zope.generations, like renaming classes or modules, etc.). In my experience writing evolution scripts is a big pain, so I avoid that where possible using various tricks: - class attributes with sensible default values for all newly-added attributes - autovivification via __getattr__ or properties (e.g. zope.cachedescriptors.property.Lazy) Marius Gedminas -- 5. Is RetchMail standards-compliant? Quick answer: HA HA HA HA HA HA no. -- http://alumnit.ca/wiki/index.php?page=RetchMail
Description: Digital signature
_______________________________________________ For more information about ZODB, see http://zodb.org/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev