Back to index

plone3  3.1.7
events.py
Go to the documentation of this file.
00001 
00002 from zope.component.interfaces import ObjectEvent
00003 from interfaces import IVersionedFieldModifiedEvent
00004 from zope.interface import implements
00005 from zope.event import notify
00006 
00007 class VersionedFieldModifiedEvent(ObjectEvent):
00008     """A field has been modified, versioning needed"""
00009 
00010     implements(IVersionedFieldModifiedEvent)
00011 
00012     def __init__(self, ob, *fieldnames) :
00013         """
00014         Init with a list of (AT) field names.
00015 
00016         >>> from zope.interface import Interface, implements
00017         >>> class Sample(object):
00018         ...     implements(Interface)
00019 
00020         >>> obj = Sample()
00021         >>> obj.field = 42
00022         >>> notify(VersionedFieldModifiedEvent(obj, "field"))
00023 
00024         """
00025         super(VersionedFieldModifiedEvent, self).__init__(ob)
00026         self.fieldnames = fieldnames
00027 
00028 def fieldsModified(ob, *fieldnames):
00029     notify(VersionedFieldModifiedEvent(ob, *fieldnames))
00030 
00031