Events used by ztm.topicmaps

Note

I’m working on this right now. 2010-04-26 15:13

You can subscribe to events like this:

>>> import ztm.topicmaps
>>> import zope.event
>>> import zope.component
>>> @zope.component.adapter(ztm.topicmaps.interfaces.ITopicCreatedEvent)
... def new_topic(topic):
...     """Triggered every time a new topic is created."""
...     print "Rejoice! A new topic was added: %r"%(topic)
...

Now you must register the handler with the component registries.

>>> zope.component.provideHandler(new_topic)

Does it work?

>>> topicmap = ztm.topicmaps.topicmap.TopicMap()
>>> topic = topicmap.createTopic(__reprname__='topic')
Rejoice! A new topic was added: <Topic topic>

Events

Event Triggered when… Attributes
ITopicCreatedEvent … a new topic is created. topic
ITopicDeletedEvent … a topic about to be deleted. topic
ITopicInstanceAddedEvent … a new instance topic is added to a topic type. instance, type
ITopicInstanceRemovedEvent … an instance topic is removed from a topic type. instance, type
INewTopicTypeEvent … a topic gets its first instance and becomes a topic type. type
INoLongerTopicTypeEvent … a topic no longer have any topic instances. type
ISuperSubTypeRelationshipAddedEvent … a subtype is added to a topic. super, sub
ISuperSubTypeRelationshipRemovedEvent … a subtype is removed from a topic. super, sub
ISubjectIdentifierAddedEvent … a subject identifier is added to a topic. identifier, topic
ISubjectIdentifierRemovedEvent … a subject identifier is removed from a topic. identifier, topic
ITopicModifiedEvent … a topic was modified. topic

Names

Event Triggered when… Attributes
INameCreatedEvent … a new name is created. name, type, topic
INameUpdatedEvent … a name value is changed. name, oldvalue, newvalue
INameDeletedEvent … a name is deleted. name, type, topic
IVariantCreatedEvent … a variant is created. variant, scope, topic
IVariantUpdatedEvent … a variant is created. variant, oldvalue, newvalue
IVariantDeletedEvent … a variant is deleted. variant, scopeid, topic
INewNameTypeEvent … a topic first becomes a type for a name. type
INoLongerNameTypeEvent … a topic no longer types any names. type

Occurrences

Event Triggered when… Attributes
IOccurrenceCreatedEvent … an occurrence is created occurrence, type, topic
IOccurrenceUpdatedEvent … an occurrence value is updated. occurrence, oldvalue, newvalue
IOccurrenceDeletedEvent … an occurrence is deleted. occurrence, type, topic
INewOccurrenceTypeEvent(object): … a topic types its first occurrence. type
INoLongerOccurrenceTypeEvent … a topic no longer types any occurrences. type

Associations and roles

Event Triggered when… Attributes
IAssociationCreatedEvent … an association is created. association, type
IAssociationDeletedEvent(object): … an association is deleted. association, type
IRoleCreatedEvent … a new role is created. role, player, type
IRoleDeletedEvent … a role is deleted role, player, type
ICreateAssociationCheck TODO: Not sure what this is used for. type, roles, scope
IDeleteAssociationCheck TODO: Not sure what this is used for. association
INewAssociationTypeEvent … a topic types its first association. type
INoLongerAssociationTypeEvent … a topic no longer types any associations. type
INewRoleTypeEvent … a topic types its first role. type
INoLongerRoleTypeEvent … a topic no longer types any roles.”“” type
INewRoleTypePlayerEvent … a topic starts playing a new role type. type, player
INoLongerRoleTypePlayerEvent … a topi cno longer plays a specific role type. type, player

Table Of Contents

Previous topic

Frequently Asked Questions

Next topic

API documentation

This Page