durusmail: durus-users: renaming module/classes problem
renaming module/classes problem
2005-03-15
2005-03-15
2005-03-15
2005-03-15
2005-03-15
renaming module/classes problem
Mario Ruggier
2005-03-15
On Mar 15, 2005, at 7:26 PM, David Binger wrote:

> To change the classes of the instances in the database, you need to
> 1) unpickle each one with the old class (foo.bar.Baz) available (or
> with a temporary fake in sys.modules),
> 2) assign x.__class__ = new.bar.Baz on each x,
> 3) call x._p_note_change() on each x, and,
> 4) last but not least, also call z._p_note_change() on every instance
>    z that contains a reference to anything whose class has changed.

For example.... on get_root() !!!

Geeeesass! That took me a long time to realize that...

And probably it would never have never have occured to me... so a big
thanks.
Still, i suggest root specifically is mentioned as an example of such a
container in the doc, or the faq... somebody else might save a few
hairs (should they have any still ;(.

Does x._p_changed need to be set to True, or is x._p_note_changed()
enough?

> 5) commit()
> 6) pack()
>
> Step 6 is optional, but after doing it, you should be able to verify
> with
> grep that the string 'foo.bar.Baz' is no longer in the database
> (unless of
> course it is a user's name or something like that).

Right, i usually do not grep binary files, but yes, it is handy.

Thanks again, mario



reply