I wrote a new user-class based on BasicUser and PropertyManager. Now I can add and change properties. But when I restart the server, they are gone.

Any ideas where I could find the cause of this behaviour?

Threre are a number of properties defined in the class (_properties). These are not affected.

有帮助吗?

解决方案 2

The missing base class was "Persistent". I assumed that it must be a base class of PropertyManager but it isn't.

其他提示

Data that disappears when you restart the server is almost always something that is an effect of the changes not getting written to the Database properly.

This in turn usually happens because you are modifying a list or a dictionary and not persisting the object to disc. There are various ways of getting around this problem. In the case of properties, you should use the object methods for updating and adding properties.

These are called manage_addProperty, manage_editProperties, manage_delProperties and manage_changeProperties.

You can find examples of usage at the bottom of this page in the Zope2 Book.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top