[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - IUtilityService.py:1.1.2.1

Jim Fulton jim@zope.com
Sun, 6 Jan 2002 18:38:41 -0500


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

Added Files:
      Tag: Zope-3x-branch
	IUtilityService.py 
Log Message:
Factored IComponentArchitecture into service interfaces

=== Added File Zope3/lib/python/Zope/ComponentArchitecture/IUtilityService.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: IUtilityService.py,v 1.1.2.1 2002/01/06 23:38:40 jim Exp $
"""

from Interface import Interface

class IUtilityService(Interface):

    def provideUtility(providedInterface, component):
        """Provide a utility

        A utility is a component that provides an interface.
        """

    def getUtility(object, interface, default=None):
        """Look up a utility that provides an interface

        The object provides a place to look for placeful adapters.

        A Zope.ComponentArchitecture.ComponentLookupError will be
        raised if the component can't be found.
        """