============================= Lifecycle Event Subscribers ============================= .. automodule:: zc.intid.subscribers :no-members: .. _configuring: Configuring =========== To configure, you need to include ``subscribers.zcml``, while being careful about how ``zope.intid`` is configured: .. code-block:: xml KeyReferences and zope.intid ============================ These subscribers do not register/unregister a :class:`~zope.keyreference.IKeyReference` with the intid utilities. Instead, it registers the actual object, and the events that are broadcast are broadcast holding the actual object. ``IKeyReferenceces``, especially :class:`~zope.keyreference.persistent.KeyReferenceToPersistent`, are used for a few reasons. First, they provide a stable, object-identity-based pointer to objects. To be identity based, this pointer is independent of the equality and hashing algorithms of the underlying object. Identity-based comparisons are necessary for the classic :mod:`zope.intid` utility implementation which uses a second ``OIBTree`` to maintain the backreferece from object to assigned intid (clearly you don't want two non-identical objects which happen to compare equally *now* to get the same intid as that condition may change). Likewise, these references are all defined to be mutually comparable, no matter how they are implemented, a condition necessary for them to all work together in a ``OIBTree``. Lastly, these references are meant to be comparable during ZODB conflict resolution (the original persistent objects probably won't be), which, again, is a condition of the implementation using a ``OIBTree.`` A consequence of avoiding these references is that generally persistent objects that are expected to have intids assigned *should not* be used as keys in an ``OxBTree`` or stored in an ``OOSet.`` Instead, all such data structures *should* use the integer variations (e.g., ``IISet``), with the intid as the key. Subscriber Functions ==================== .. autofunction:: zc.intid.subscribers.addIntIdSubscriber .. autofunction:: zc.intid.subscribers.removeIntIdSubscriber .. autofunction:: zc.intid.subscribers.intIdEventNotify