[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - ZMIViewUtility.py:1.1.2.1

Jim Fulton jim@zope.com
Thu, 31 Jan 2002 19:31:51 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI
In directory cvs.zope.org:/tmp/cvs-serv21417

Added Files:
      Tag: Zope-3x-branch
	ZMIViewUtility.py 
Log Message:
Added utility view for getting ZMI tab data

=== Added File Zope3/lib/python/Zope/App/ZMI/ZMIViewUtility.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: ZMIViewUtility.py,v 1.1.2.1 2002/02/01 00:31:51 jim Exp $
"""

from Zope.ComponentArchitecture.ContextDependent import ContextDependent
from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
from Zope.ComponentArchitecture import getService

class ZMIViewUtility(ContextDependent):

    __implements__ = IBrowserPublisher

    def views(self):
        context = self.getContext()
        zmi_view_service = getService(context, 'ZMIViewService')
        views = zmi_view_service.getViews(context)
        return [{'label': view[0], 'action': view[1]}
                for view in views]