Hi Stéphane,<div><br></div><div>Maybe this will be helpful: <a href="http://www.zodb.org/documentation/articles/ZODB2.html#persistent-aware-types">http://www.zodb.org/documentation/articles/ZODB2.html#persistent-aware-types</a></div>
<div>I think what you are looking for is an OOBTree with the key being your uuid and the value being the path to your Resources object.</div><div><br></div><div>def get_uuid(uuid, context):</div><div> resource_path = context.my_btree.get(uuid, None)</div>
<div> if uuid is not None:</div><div> return context.unrestrictedTraverse(resource_path)</div><div><br></div><div>You can get the path of an object in OFS by calling absolute_url method of that object.</div><div>
<br>
</div><div>Hope this helps,</div><div>Alex.</div><div><br><div class="gmail_quote">On 28 June 2011 12:10, Stéphane Klein <span dir="ltr"><<a href="mailto:stephane@harobed.org">stephane@harobed.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Le 28/06/2011 10:21, Thierry Florac a écrit :<br>
<div class="im">>> I use ZODB to record some Resources.<br>
>><br>
>> All my Resources have an "uuid" field.<br>
>><br>
>> All work well but I would like append a BTree to ZODB root object to<br>
>> "index" uuid of all my resources.<br>
>><br>
>> I would like record to this BTree index only Resources commited to ZODB<br>
>> database.<br>
>><br>
>> How can I connect a function to "commit" event ?<br>
>> In this function, how can I found all object modified ?<br>
>> How can I found all object removed to the database ?<br>
>><br>
>> Other question : are there already a package to perform this task ?<br>
><br>
><br>
> The matching package is zope.catalog.<br>
> It provides all you need (catalog and indexes) to handle your task.<br>
> Objects creations and modifications are followed automatically by several<br>
> subscribers as soon as this package is correctly registered.<br>
> z3c.catalog and hurry.query packages can be good extensions packages to<br>
> look at...<br>
<br>
</div>I've already looked zope.catalog and repoze.catalog.<br>
<br>
Question : I haven't docid, can I use uuid here ? but it isn't the<br>
feature I want : I would like retrieve my object from uuid.<br>
<br>
Do you have an example of code about it ?<br>
<br>
More information about my aim :<br>
<br>
root (ZODB)<br>
uuid => { "uuid_value1": resource_A, "uuid_value2": resource_B, ... }<br>
folder_1<br>
resource_A<br>
folder_2<br>
resource_B<br>
<br>
I would like this function :<br>
<br>
>>> get_by_uuid("uuid_value1")<br>
=> return resource_A<br>
<br>
Regards,<br>
<div class="im">Stephane<br>
<br>
--<br>
Stéphane Klein <<a href="mailto:stephane@harobed.org">stephane@harobed.org</a>><br>
blog: <a href="http://stephane-klein.info" target="_blank">http://stephane-klein.info</a><br>
Twitter: <a href="http://twitter.com/klein_stephane" target="_blank">http://twitter.com/klein_stephane</a><br>
pro: <a href="http://www.is-webdesign.com" target="_blank">http://www.is-webdesign.com</a><br>
<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">For more information about ZODB, see the ZODB Wiki:<br>
<a href="http://www.zope.org/Wikis/ZODB/" target="_blank">http://www.zope.org/Wikis/ZODB/</a><br>
<br>
ZODB-Dev mailing list - <a href="mailto:ZODB-Dev@zope.org">ZODB-Dev@zope.org</a><br>
<a href="https://mail.zope.org/mailman/listinfo/zodb-dev" target="_blank">https://mail.zope.org/mailman/listinfo/zodb-dev</a><br>
</div></div></blockquote></div><br></div>