Lennart Regebro writes:
.... I can change _object_workflow_version without trouble if I do it somewhere else, but any changes to _object_workflow_version or any otehr attributes I do in __setstate__ doesn't persist after a restart of Zope. Interesting...
As an optimization, Zope writes objects back to the storage only when it knows they have changed. "__setstate__" is called internally by the loading process. It is quite reasonable that Zope assumes that a freshly loaded object does not yet have changes. Thus, if there are no changes later, the object will not be written back, For the normal use, this should make no difference. When the objects are changed, they are written to the storage with the new attribute. When not, the new attributes are recreated the next time the object is loaded. This should make only a problem when you want to do more sophisticated actions (as you apparently do: --> upgradeWorkflow). Be aware, that what you can/should do inside "__setstate__" is very limited. Like in "__init__", "self" is not yet acquisition wrapped. It may, therefore, behave very different than is normal. You may also consider a class attribute for providing values for new attributes. Dieter