On 16 August 2010 17:29, Pedro Ferreira <jose.pedro.ferre...@cern.ch> wrote:
>> Consider using one
>> of these alternatives instead:
>> * Set the IOTreeSet as an attribute directly on the persistent object.
> You mean on the persistent object I am using as key?


>> * Use http://pypi.python.org/pypi/zope.intid and use the intid for the
>> key. (This uses http://pypi.python.org/pypi/zope.keyreference which
>> uses the referenced object's oid and database name to perform the
>> comparison, avoiding the need to load the persistent object.)
> This looks really nice. However it seems to depend on a lot of zope
> libraries that I'm currently including: location, component, security...
> well, I guess they're not that large. I will give it a look, maybe I'll use
> it.

I guess you could avoid the dependencies by using
(obj._p_jar.db().database_name, obj._p_oid) as the key.

For more information about ZODB, see the ZODB Wiki:

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

Reply via email to