Reference

Interfaces

Key-reference interfaces

exception zope.keyreference.interfaces.NotYet[source]

Bases: 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 Type Id

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

__call__()

Get the object this reference is linking to.

__hash__()

Get a unique identifier of the referenced object.

__cmp__(ref)

Compare the reference to another reference.

BBB for Python 2.

__eq__(ref)
__lt__(ref)
__ne__(ref)
__gt__(ref)
__le__(ref)
__ge__(ref)

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.

zope.keyreference.persistent.connectionOfPersistent(ob)[source]

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.