Reference

Interfaces

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

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

Implementation:zope.schema.DottedName
Read Only:False
Required:True
Default Value:None
Allowed Type:str
__call__()

Get the object this reference is linking to.

__hash__()

Get a unique identifier of the referenced object.

__eq__(ref)

KeyReferences must be totally orderable.

__lt__(ref)

KeyReferences must be totally orderable.

__ne__(ref)

KeyReferences must be totally orderable.

__gt__(ref)

KeyReferences must be totally orderable.

__le__(ref)

KeyReferences must be totally orderable.

__ge__(ref)

KeyReferences must be totally orderable.

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.