[Zope-Checkins] CVS: Zope3/lib/python/Zope/Event - IEvent.py:1.1.2.1 IEventChannel.py:1.1.2.1 IEventFilter.py:1.1.2.1 IEventService.py:1.1.2.1 IEventSet.py:1.1.2.1 IObjectEvent.py:1.1.2.1 ISubscribable.py:1.1.2.1 ISubscriber.py:1.1.2.1 __init__.py:1.1.2.1
Chris Withers
chrisw@nipltd.com
Fri, 22 Feb 2002 07:56:22 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Event
In directory cvs.zope.org:/tmp/cvs-serv19162
Added Files:
Tag: Zope-3x-branch
IEvent.py IEventChannel.py IEventFilter.py IEventService.py
IEventSet.py IObjectEvent.py ISubscribable.py ISubscriber.py
__init__.py
Log Message:
SB/CW - initial checkin of interfaces for Event Stuff
=== Added File Zope3/lib/python/Zope/Event/IEvent.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: IEvent.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""
from Interface import Interface
class IEvent(Interface):
"""The Base interface for Events"""
=== Added File Zope3/lib/python/Zope/Event/IEventChannel.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: IEventChannel.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""
from ISubscribable import ISubscribable
from ISubscriber import ISubscriber
class IEventChannel(ISubscribable, ISubscriber):
"""Interface for objects which distribute events to subscribers. """
=== Added File Zope3/lib/python/Zope/Event/IEventFilter.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: IEventFilter.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""
from Interface import Interface
class IEventFilter(Interface):
"""Interface for predicates used to filter events."""
def __call__(event):
"""Return true if event passes, or false."""
=== Added File Zope3/lib/python/Zope/Event/IEventService.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: IEventService.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""
from ISubscribable import ISubscribable
class IEventService(ISubscribable):
"""The EventService service is the 'root channel'.
Its subscribers include other channels.
It is also the 'default destination' for events
when they are generated.
"""
def publish(event):
"""
Notify all subscribers of the channel of event.
Events will often be propagated to higher level IEventServices;
This is a policy decision for the IEventService.
"""
=== Added File Zope3/lib/python/Zope/Event/IEventSet.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: IEventSet.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""
from Interface import Interface
class IEventSet(ISubscriber):
"""An unordered buffer of events."""
def size():
"""Returns the number of events stored."""
def get(n=None):
"""Returns a collection of events.
This must be iteratable"""
=== Added File Zope3/lib/python/Zope/Event/IObjectEvent.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: IObjectEvent.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""
from IEvent import IEvent
class IObjectEvent(IEvent):
"""The Base interface for Events fired by objects"""
def getObject():
"""Return the object which the event is 'about'"""
=== Added File Zope3/lib/python/Zope/Event/ISubscribable.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: ISubscribable.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""
from Interface import Interface
class ISubscribable(Interface):
"""Objects that broadcast events to subscribers."""
def subscribe(subscriber, event_types=None, filter=None):
"""Add subscriber to the list of subscribers for the channel.
subscriber must implement ISubscriber.
event_types, if supplied, is a list of the event interfaces
about which subscriber should be notified.
filter, if supplied, must implement IEventFilter; subscriber
will be notified of events only if they pass.
"""
def unsubscribe(subscriber):
"""Remove subscriber from the list of subscribers.
Raises Zope.Excetions.NotFound if subscriber wasn't already subscribed.
"""
=== Added File Zope3/lib/python/Zope/Event/ISubscriber.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: ISubscriber.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""
from Interfaces import Interfaces
class ISubscriber:
"""Interface for objects which receiving event notifications."""
def notify(event):
"""ISubscribables call this method to indicate an event.
This method must not block!
This method may raise an exception to veto the event
"""
=== Added File Zope3/lib/python/Zope/Event/__init__.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: __init__.py,v 1.1.2.1 2002/02/22 12:56:22 chrisw Exp $
"""