Reference

nti.intid.interfaces

Interfaces for working with integer IDs.

interface nti.intid.interfaces.IIntIds[source]

Extends: zc.intid.interfaces.IIntIds, zc.intid.interfaces.IIntIdsSubclass, zope.location.interfaces.IContained

Advanced extensions to an integer ID catalog.

Normal users will have no need of this interface.

randomize()

Randomize the next id.

Do not use this method.

force_register(uid, ob, check=True)

Register an object.

Do not use this method.

Parameters:
  • uid – Registration id
  • ob – Object to register
  • check – Validation check flag
force_unregister(uid, ob=None, notify=False, remove_attribute=True)

Unregister an object.

Do not use this method.

Parameters:
  • uid – Id to unregister
  • ob – Obj to unregister [optional]
  • notify – Flag to trigger an IIdRemovedEvent
  • notremove_attribute – Flag to remove intid attribute

nti.intid.common

Common utilities.

Currently, there is nothing here.

See zc.intid.subscribers

nti.intid.common.addIntId(ob, event=None)[source]

Deprecated alias for zc.intid.subscribers.addIntIdSubscriber()

nti.intid.common.add_intid(ob, event=None)

Deprecated alias for zc.intid.subscribers.addIntIdSubscriber()

nti.intid.common.removeIntId(ob, event=None)[source]

Deprecated alias for zc.intid.subscribers.removeIntIdSubscriber()

nti.intid.common.remove_intid(ob, event=None)

Deprecated alias for zc.intid.subscribers.removeIntIdSubscriber()

nti.intid.subscribers

Subscribers for events.

These are configured by loading this packages’s configure.zcml.

nti.intid.subscribers.subscriberEventNotify(event)[source]

Event subscriber to dispatch zc.intid.interfaces.ISubscriberEvent to interested adapters.

The adapters are registered on event.object, event.

nti.intid.utility

Contains a zc.intid.utility derived utility for managing intids. The primary reason to do this is to provide better exceptions, and future proofing of behaviour.

class nti.intid.utility.IntIds(attribute, family=None)[source]

Bases: zc.intid.utility.IntIds

A integer ID utility that uses 64-bit values.

Implements nti.intid.interfaces.IIntIds

getId(ob)[source]

Get the id of the Acquisition.aq_base() of ob.

See the note for queryId().

get_id(ob)

Get the id of the Acquisition.aq_base() of ob.

See the note for queryId().

queryId(ob, default=None)[source]

Query for the id of the Acquisition.aq_base() of ob.

Note

If you pass a broken object (in the ZODB sense), this will hide that fact. We have to activate it, but if it is broken, we will not be able to. However, we catch KeyError, which is a superclass of the POSKeyError that gets thrown, so you cannot distinguish it at this point.

We do not change this for backwards compatibility.

register(object) → int[source]

Register the Acquisition.aq_base() of object and return the integer id.

unregister(object) → None[source]

Unregister the Acquisition.aq_base() of object.

family = <BTree family using 64 bits. Supports signed integer values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 and maximum unsigned integer value 18,446,744,073,709,551,615.>

The family of BTrees to use.

nti.intid.wref

Weak references to things with intids. These serve the same purpose as general persistent weak references from persistent.wref, but are specific to things with intids, and do not keep the object alive or accessible once the object is removed from the intid catalog (whereas weak refs do until such time as the database is GC’d).

class nti.intid.wref.ArbitraryOrderableWeakRef(content_object)[source]

Bases: nti.intid.wref.WeakRef

A subclass of WeakRef that is orderable in a completely arbitrary way (based simply on intids).

class nti.intid.wref.NoCachingArbitraryOrderableWeakRef(content_object)[source]

Bases: nti.intid.wref.ArbitraryOrderableWeakRef

Does not allow caching.

class nti.intid.wref.WeakRef(content_object)[source]

Bases: nti.intid.wref._AbstractWeakRef

A weak reference to a content object (generally, anything with an intid). Call this object to return either the object, or if the object has gone away, None.

Note that this is not a persistent object. It is not mutable (and it’s also very tiny), and it has value semantics, so there’s very little need to be persistent. This means it’s suitable for use in OOSet objects and OOBTree objects as keys (if subclassed to provide total ordering!)