Peter Bengtsson wrote:

   def __init__(self):
       self.queue = {}

self.queue seem is empty each time I restart Zope.
That's because dictionaries are not derived from Persistent. Try PersistentDict.

D'oh! That's confusing. Isn't there a class that gathers all of these in one.

It seems confusing, you derive from Persistent but only some are accepted.
Does that mean that there's PersistentFloat and PersistentTuple too?
If not, why *only* dicts?

No, this issue applies to mutable attributes..

self.a = 1.1
self.b = (1,2,3)
self.b = (4,5,6)

These will persist as is, because you're rebinding the attribute (reference) each time.

However, for ...

self.queue[1] = 2

This doesn't rebind self.queue.
So another way you could 'persist' this change is ..

self.queue[1] = 1
self.queue = self.queue
Zope3-users mailing list

Reply via email to