Le 28/06/2011 10:21, Thierry Florac a écrit :
>> I use ZODB to record some Resources.
>> All my Resources have an "uuid" field.
>> All work well but I would like append a BTree to ZODB root object to
>> "index" uuid of all my resources.
>> I would like record to this BTree index only Resources commited to ZODB
>> database.
>> How can I connect a function to "commit" event ?
>> In this function, how can I found all object modified ?
>> How can I found all object removed to the database ?
>> Other question : are there already a package to perform this task ?
> The matching package is zope.catalog.
> It provides all you need (catalog and indexes) to handle your task.
> Objects creations and modifications are followed automatically by several
> subscribers as soon as this package is correctly registered.
> z3c.catalog and hurry.query packages can be good extensions packages to
> look at...

In repoze.catalog documentation, I read :

Note that when you call index_doc, you pass in a docid as the first 
argument, and the object you want to index as the second argument. When 
we index the peach object above we index it with the docid 1. Each docid 
must be unique within a catalog; when you query a repoze.catalog 
catalog, you’ll get back a sequence of document ids that match the query 
you supplied, which you’ll presumably need to map back to the content 
object in order to make sense of the response; you’re responsible for 
keeping track of which objects map to which document id yourself.
Url : http://docs.repoze.org/catalog/overview.html#indexing

"you’re responsible for keeping track of which objects map to which 
document id yourself." => it is this part I would like to implement.


Stéphane Klein <steph...@harobed.org>
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to