[Zope-Checkins] CVS: Zope3/lib/python/Zope/Event - ObjectEvent.py:1.1.2.1

Chris Withers chrisw@nipltd.com
Fri, 22 Feb 2002 13:35:24 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Event
In directory cvs.zope.org:/tmp/cvs-serv516

Added Files:
      Tag: Zope-3x-branch
	ObjectEvent.py 
Log Message:
SB/CW -  d'oh! forgot a file :-S

=== Added File Zope3/lib/python/Zope/Event/ObjectEvent.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

Revision information:
$Id: ObjectEvent.py,v 1.1.2.1 2002/02/22 18:35:22 chrisw Exp $
"""

from IObjectEvent import IObjectAddedEvent, IObjectModifiedEvent
from IObjectEvent import IObjectRemovedEvent, IObjectMovedEvent
from EventService import EventService

class ObjectAddedEvent:
    """An object has been added to a container."""

    __implements__ = IObjectAddedEvent

    def __init__(self, location):
        self.__location = location
        
    def getLocation(self):        
        """returns the object location after it has been added to the container"""
        return self.__location

class ObjectModifiedEvent(ObjectAddedEvent):
    """An object has been modified"""

    __implements__ = IObjectModifiedEvent

class ObjectRemovedEvent(ObjectAddedEvent):
    """An object has been removed from a container"""

    __implements__ = IObjectRemovedEvent

class ObjectMovedEvent(ObjectAddedEvent):
    """An object has been moved"""

    __implements__ = IObjectMovedEvent

    def __init__(self, from_location, location):
        ObjectAddedEvent.__init__(self, location)
        self.__from_location = from_location
        
    def getFromLocation(self):
        """location of the object before it was moved"""
        return self.__from_location