[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/interface - detail.pt:1.1 __init__.py:1.2 configure.zcml:1.2
Jeremy Hylton
jeremy@zope.com
Mon, 23 Jun 2003 12:14:20 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/services/interface
In directory cvs.zope.org:/tmp/cvs-serv4851/src/zope/app/browser/services/interface
Modified Files:
__init__.py configure.zcml
Added Files:
detail.pt
Log Message:
Add primitive detail view.
=== Added File Zope3/src/zope/app/browser/services/interface/detail.pt ===
<html metal:use-macro="context/@@standard_macros/page"
i18n:domain="zope">
<div metal:fill-slot="body" tal:define="ignored view/setup">
<h2 i18n:translate="">Interface
<span tal:content="view/name">name</span>
</h2>
<div tal:condition="view/doc">
<h3>Documentation</h3>
<div tal:content="view/doc">This is a doc string.</div>
</div>
<div tal:condition="view/methods">
<h3>Methods</h3>
<ul>
<li tal:repeat="method view/methods"
tal:content="method/__name__">Method name</li>
</ul>
</div>
<div tal:condition="view/schema">
<h3>Schema</h3>
<ul>
<li tal:repeat="field view/schema"
tal:content="field/__name__">Field name</li>
</ul>
</div>
</div>
</html>
=== Zope3/src/zope/app/browser/services/interface/__init__.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/services/interface/__init__.py:1.1 Sun Jun 22 16:39:24 2003
+++ Zope3/src/zope/app/browser/services/interface/__init__.py Mon Jun 23 12:14:19 2003
@@ -13,9 +13,47 @@
##############################################################################
"""Browser view for the LocalInterfaceService."""
+from zope.interface.interfaces import IMethod
+from zope.schema.interfaces import IField
+
+from zope.app import zapi
+
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]
+
+class Detail:
+
+ def setup(self):
+ id = self.request["id"]
+ iface = self.context.getInterface(id)
+
+ from zope.proxy import getProxiedObject
+ iface = getProxiedObject(iface)
+
+ self.name = iface.__name__
+ # XXX the doc string needs some formatting for presentation
+ # XXX self.doc = iface.__doc__
+ self.doc = iface.getDoc()
+ self.methods = []
+ self.schema = []
+
+ for name in iface:
+ defn = iface[name]
+ if IMethod.isImplementedBy(defn):
+ self.methods.append(defn)
+ elif IField.isImplementedBy(defn):
+ self.schema.append(defn)
+
+ def getServices(self):
+ sm = zapi.getServiceManager(self.context)
+ for name, iface in sm.getServiceDefinitions():
+ service = sm.queryService(name)
+ if service is None:
+ continue
+ if queryAdapter(service, IXXX):
+ pass
+
=== Zope3/src/zope/app/browser/services/interface/configure.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/browser/services/interface/configure.zcml:1.1 Sun Jun 22 16:39:24 2003
+++ Zope3/src/zope/app/browser/services/interface/configure.zcml Mon Jun 23 12:14:19 2003
@@ -18,4 +18,14 @@
title="Browse"
/>
+<page
+ for="zope.app.interfaces.component.IInterfaceService"
+ name="detail.html"
+ template="detail.pt"
+ class=".Detail"
+ permission="zope.ManageServices"
+ menu="zmi_views"
+ title="Detail"
+ />
+
</zopeConfigure>