[Zope-dev] ZODB : store and retrieve (more specific)

Johan Carlsson johanc@torped.se
Tue, 25 Jul 2000 14:13:06 +0200


> Hi, 
> 
> 
> I want to create a persistent List (I want to store data for a long time 
> without using a relational database). I have found source of such list but 
> I don't know how to use it. 
> 
> The things that I want to know are : 
> --> how could I use personnal object (in Python language)
> --> how could I store and retrieve these object ?
> 
> I Hope that anybody can help me.... thanks...
>

You can either use the PersistentMapping object that comes with Zope 
"from ZODB.PersistentMapping import PersistentMapping" or 
AndrewWilcox's http://www.zope.org/Members/AndrewWilcox/PersistentListDict. 
PersistentMapping is limited to string keys only, which is sufficient most of the time. 
Just create a PersistentMapping in your Zope class and use it as if it was 
a regular python dictionary. PersistentMapping takes care of setting 
the necessary attributes for it to be persistent.

Alternative you can use a TinyTable directly in Zope for storing a table.

Regards,
Johan Carlsson