[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - IAdapterService.py:1.1.2.1
Jim Fulton
jim@zope.com
Sun, 6 Jan 2002 18:38:51 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv8432
Added Files:
Tag: Zope-3x-branch
IAdapterService.py
Log Message:
Factored IComponentArchitecture into service interfaces
=== Added File Zope3/lib/python/Zope/ComponentArchitecture/IAdapterService.py ===
##############################################################################
#
# Copyright (c) 2001 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: IAdapterService.py,v 1.1.2.1 2002/01/06 23:38:51 jim Exp $
"""
from Interface import Interface
class IAdapterService(Interface):
def provideAdapter(forInterface, providedInterface, maker):
"""Provide an adapter
An adapter provides an interface for objects that have another
interface.
Arguments:
forInterface -- The interface the adapter provides an interface for.
providedInterface -- The provided interface
maker -- a callable object that gets an adapter component for
a context component.
"""
def getAdapter(object, interface, default=None):
"""Look up an adapter that provides an interface for an object
The object also provides a place to look for placeful adapters.
A Zope.ComponentArchitecture.ComponentLookupError will be
raised if the component can't be found.
"""