[ZODB-Dev] Weird KeyError with OOBTree

Laurence Rowe l at lrowe.co.uk
Mon Aug 16 12:43:09 EDT 2010


On 16 August 2010 17:29, Pedro Ferreira <jose.pedro.ferreira at 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?

Yes.

>> * 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.

Laurence


More information about the ZODB-Dev mailing list