[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/interface - __init__.py:1.1 browse.pt:1.1 configure.zcml:1.1

Jeremy Hylton jeremy@zope.com
Sun, 22 Jun 2003 16:39:24 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/services/interface
In directory cvs.zope.org:/tmp/cvs-serv21157/src/zope/app/browser/services/interface

Added Files:
	__init__.py browse.pt configure.zcml 
Log Message:
Add a view that lists all the registered interfaces.

The view creates links to a not-yet-created detail view.


=== Added File Zope3/src/zope/app/browser/services/interface/__init__.py ===
##############################################################################
#
# Copyright (c) 2003 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.
#
##############################################################################
"""Browser view for the LocalInterfaceService."""

class Interfaces:

    def getInterfaces(self):
        L = [(iface.__name__, id) for id, iface in self.context.items()]
        L.sort()
        return [{"id": id, "name": name} for name, id in L]


=== Added File Zope3/src/zope/app/browser/services/interface/browse.pt ===
<html metal:use-macro="context/@@standard_macros/page"
      i18n:domain="zope">

<div metal:fill-slot="body">

<h2 i18n:translate="">Interfaces registered with the interface service</h2>

<ul>
<li tal:repeat="dict view/getInterfaces">
    <a href="/" 
       tal:attributes="href string:detail.html?id=${dict/id}"
       tal:content="dict/name">An interface name
    </a>
</li>
</ul>

</div>

</html>


=== Added File Zope3/src/zope/app/browser/services/interface/configure.zcml ===
<zopeConfigure xmlns="http://namespaces.zope.org/browser">

<menuItem 
    menu="add_service"
    for="zope.app.interfaces.container.IAdding"
    action="zope.app.services.LocalInterfaceService"
    title="Local Interface Service"
    permission="zope.ManageServices"
    />

<page
    for="zope.app.interfaces.component.IInterfaceService"
    name="browse.html"
    template="browse.pt"
    class=".Interfaces"
    permission="zope.ManageServices"
    menu="zmi_views"
    title="Browse"
    />

</zopeConfigure>