[Zope] How to store a python list

Dieter Maurer dieter at handshake.de
Sun Oct 5 15:55:59 EDT 2003


ken at practical.org wrote at 2003-10-4 13:34 +0200:
 > I have a dtml method that returns a python list (actually a list of lists) and I would like to store this list as a persistent object. I need to make a lot of these so it should be lightweight. 
 > 
 > Is there a Product that does this?

Any persistent instance can store a list (and it becomes
persistent). You must be careful however, when you change the list
to tell the object that it changed.

Alternatively, you can use a "ZODB.PersistentList.PersistentList".
In this case, the list itself is persistent and modifications to
it are automatically written to the storage.

Modifications to sublists are not automatically recognized, though.


Dieter



More information about the Zope mailing list