On Tue, Jun 19, 2012 at 2:29 PM, Malthe Borch <mbo...@gmail.com> wrote:
> On 19 June 2012 19:54, Claudiu Saftoiu <csaft...@gmail.com> wrote:
> > That is, a function called whenever the object is loaded, that does all
> > necessary backwards-compatibility
> > work right there. It separates the backwards-compat code cleanly, and
> > only updates the objects
> > as-needed... though still a minor performance hit as it does the check
> > time the object is loaded.
> > Is there a way to do that last option? What's the best practice for this
> > sort of thing, in general?
> You'll need to override ``__new__``. That's your hook. It's called
> when the database instantiates the object. Note that this is always
> true for Python. The ``__new__`` method is always called before an
> object is instantiated.
Thanks, I wasn't aware. Seems to work - much appreciated!
For more information about ZODB, see http://zodb.org/
ZODB-Dev mailing list - ZODB-Dev@zope.org