[ZODB-Dev] Mutating class of an instance

Marius Gedminas marius at gedmin.as
Wed Jul 2 10:55:32 EDT 2008


On Wed, Jul 02, 2008 at 08:07:56AM -0400, Erik Dahl wrote:
> I have a situation where I want to mutate the class of an instance like 
> this:
>
> inst.__class__ = NewClass

Is inst a persistent object?  Then your only chance to get this to work
is to find *all* objects that reference inst and mark them _p_changed.

> I'm in zeo land.  When I do this in one client things work fine.

More careful testing would show that not to be the case, I think.

> But of 
> course the other clients who have already loaded the instance still hold 
> the old class.  Restarting them gets the new class so it did get stored 
> properly in the pickle (which I would expect).

The class is also stored in every reference to that object.

> Any chance I can get zeo 
> to tell the other clients about the new class?

Marius Gedminas
-- 
It's my understanding that although in principle TCP can handle huge
throughputs in practice many stacks haven't been optimized for that case, so
you have to either use a utility which opens multiple TCP sessions in parallel
or do something really radical like upgrade to the latest version of the linux
kernel.
		-- Bram Cohen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20080702/faa7bad5/attachment.bin


More information about the ZODB-Dev mailing list