[Zope] __setstate__ not happening.

Lennart Regebro lennart@regebro.nu
Sun, 27 Jan 2002 19:57:42 +0100


From: "Dieter Maurer" <dieter@handshake.de>
>   This should make only a problem when you want to do more
>   sophisticated actions (as you apparently do: --> upgradeWorkflow).

Well, that part seemes to work much better than the non sofisticated part of
it:
self._object_workflow_version = '1.1'

That never worked. The actual upgrade seemed to work sometimes. But only
sometimes.

>   Be aware, that what you can/should do inside "__setstate__" is
>   very limited.

But I don't do anything strange whatsoever. It's just that any changes I do
to the objects attributes within __setstate__ is lost at restart. This of
course completely defeats the upgrade purpose, although I don't do anything
else then what for example Catalog does...

Very strange.

> You may also consider a class attribute for providing values
> for new attributes.

Sure, but in this case the internal structure of some data has changed.
My current workaround is to simply make a python script that traverses the
whole of the database an calls the upgradeWorkflow method, so it's not a big
problem, but I feel it could be nice to use __setstate_ to upgrade these
things, since that ment that our customers could just throw in a new version
and restart the server.