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

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


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

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

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

from Interface import Interface

class IViewService(Interface):

    def defineSkin(skin, layers):
        """Define a skin as a sequence of layers

        There is a predefined skin, '', with a single layer, ''.
        """

    def provideView(forInterface, name, type, maker, layer=''):
        """Provide a view

        A view provides some type of presentation (e.g. browser, ftp)
        for components of a given interface.

        Arguments:

        forInterface -- The interface the view is for

        name -- The view name

        type -- The view type, expressed as an interface

        maker -- a callable object that gets a view component for
        a context component.

        layer -- Optional view layer. Layers are used to define skins.
        """

    def getView(object, name, type, default=None, skin=''):
        """Look up a named view of a given type for an object

        The type is expressed as an interface.

        The object also provides a place to look for placeful views.

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