/usr/share/pyshared/zope/lifecycleevent/README.txt is in python-zope.lifecycleevent 3.6.2-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | =================
Life-cycle events
=================
In Zope, events are used by components to inform each other about
relevant new objects and object modifications.
To keep all subscribers up to date it is indispensable that the life
cycle of an object is accompanied by various events.
>>> from zope.event import notify
>>> from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
>>> class Sample(object) :
... "Test class"
>>> obj = Sample()
>>> notify(ObjectCreatedEvent(obj))
>>> obj.modified = True
>>> notify(ObjectModifiedEvent(obj))
Some event consumers like catalogs and caches may need more information to
update themselves in an efficient manner. The necessary information can be
provided as optional modification descriptions of the ObjectModifiedEvent.
Some examples:
>>> from zope.interface import Interface, Attribute, implements
>>> class IFile(Interface):
... data = Attribute("Data")
...
>>> class File(object):
... implements(IFile)
...
>>> file = File()
>>> file.data = "123"
>>> notify(ObjectModifiedEvent(obj, IFile))
This says that we modified something via IFile. Note that an interface is an
acceptable description. In fact, we might allow pretty much anything as a
description and it depends on your needs what kind of descriptions you use.
|