On Wed, Jul 05, 2000 at 04:52:44PM -0700, Andy McKay wrote:
> Ok so I have an object, I have many properties persisting on the object
> using the wonderful PropertyManager. But I want to persist a dictionary.
> This isn't an option for the PropertyManager. I added a dictionary into the
> object just by adding the line: _map = {}

You will have to let the persistance machinery know that you changed the
dictionary. A dictionary is a mutable object, and persistance can only track
inmutable objects automatically. See the ZODB docs:


(http://www.zope.org/Documentation/Developer/Models/ZODB for the framed set,
choose Persitent Objects, then Persitent in the bottom-left frame).

You should either treat the dictionary as immutable:

  data = self._map
  self._map = data

or set a special flag to let the ZODB know the objetc has changed:

  self._p_changed = 1

You could also replace the dictionary by a PersitentMapping instance. See
above docs for more info.

Martijn Pieters
| Software Engineer            mailto:[EMAIL PROTECTED]
| Digital Creations          http://www.digicool.com/
| Creators of Zope               http://www.zope.org/
| ZopeStudio: http://www.zope.org/Products/ZopeStudio

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to