Re: Re: Objects with varying classes

Manuel Reinhardt <[email protected]> Fri, 28 Sep 2018 13:16:18 +0200
Newsgroups gmane.comp.web.zope.zodb
Message-ID <CAHj+0u6vJ_pmHi7H_O02EQByZNgQDdLuo_L7pHONN7+Z_MewWA@mail.gmail.com>
Thanks, I'm starting to get the picture! I'll dig through the links in that
ticket and see if I can learn something more.

Cheers,

Manuel

On Wed, 26 Sep 2018 at 16:42, Jason Madden <[email protected]>
wrote:

> In general, the only way to change the `__class__` of a Persistent object
> is to update *all* references to it. For references in a BTree, that may
> mean updating the tree itself (if small) or the individual bucket. There's
> further discussion of this here:
> https://github.com/zopefoundation/BTrees/issues/72
>
> Because finding and changing all references is usually difficult (even one
> missed reference can break everything), this is not usually recommended for
> applications (migration tools can be written to do this by crawling through
> the entire database object-by-object, but that's rarely practical for an
> application). This is one way that interfaces can be more useful than
> classes: dynamically changing the interfaces an object provides with
> `interface.alsoProvides(object, IFoo)` or
> `interface.noLongerProvides(object, IFoo)` propagates automatically to all
> references to the object.
>
> HTH,
> Jason
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "zodb" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/zodb/XNSM1W5p51I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.