Key-reference interfaces

exception zope.keyreference.interfaces.NotYet[source]

Bases: exceptions.Exception

Can’t compute a key reference for an object

It might be possible to compute one later (e.g. at the end of the transaction).

interface zope.keyreference.interfaces.IKeyReference[source]

A reference to an object (similar to a weak reference).

The references are compared by their hashes.


Key Type Id

Key references should sort first on their key type and second on any type-specific information.


Get the object this reference is linking to.


Get a unique identifier of the referenced object.


Compare the reference to another reference.

BBB for Python 2.


Persistent Objects

KeyReference for persistent objects.

Provides an IKeyReference adapter for persistent objects.

class zope.keyreference.persistent.KeyReferenceToPersistent(object)[source]

Bases: object

An IKeyReference for persistent objects which is comparable.

These references compare by database name and _p_oids of the objects they reference.


An adapter which gets a ZODB connection of a persistent object.

We are assuming the object has a parent if it has been created in this transaction.

Raises ValueError if it is impossible to get a connection.