[Zope3-checkins] CVS: Zope3/src/zope/app/browser - introspector.pt:1.6 introspector.py:1.5
Albertas Agejevas
alga@codeworks.lt
Wed, 2 Jul 2003 07:02:46 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser
In directory cvs.zope.org:/tmp/cvs-serv19248/src/zope/app/browser
Modified Files:
introspector.pt introspector.py
Log Message:
Updated the introspector to use the Interface service instead of ++module++.
Added a functional test.
=== Zope3/src/zope/app/browser/introspector.pt 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/introspector.pt:1.5 Mon Jun 30 13:04:41 2003
+++ Zope3/src/zope/app/browser/introspector.pt Wed Jul 2 07:02:15 2003
@@ -114,10 +114,13 @@
<th class="introspector">Bases:</th>
<td>
<div tal:repeat="base introspector/getBaseClassNames">
+ <span tal:replace="repeat/base/item" />
+ <!--
<a href=""
tal:attributes="href
string: ++module++${repeat/base/item}"
tal:content="repeat/base/item">Base</a>
+ -->
</div>
</td>
</tr>
@@ -137,10 +140,14 @@
<th class="introspector">Interface:</th>
<td>
<div tal:repeat="interface introspector/getInterfaceNames">
- <a href=""
- tal:attributes="href
- string: ++module++${repeat/interface/item}"
- tal:content="repeat/interface/item">Interface</a>
+ <div tal:define="url python: view.getInterfaceURL(interface)">
+ <a href=""
+ tal:attributes="href url"
+ tal:content="interface"
+ tal:condition="url">Interface</a>
+ <span tal:condition="python: not url"
+ tal:content="interface" />
+ </div>
</div>
</td>
</tr>
=== Zope3/src/zope/app/browser/introspector.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/introspector.py:1.4 Sat Jun 21 17:21:58 2003
+++ Zope3/src/zope/app/browser/introspector.py Wed Jul 2 07:02:15 2003
@@ -14,10 +14,12 @@
from zope.publisher.browser import BrowserView
from zope.app.interfaces.introspector import IIntrospector
from zope.component import getAdapter
+from zope.app import zapi
+from zope.app.services.servicenames import Interfaces
+from zope.component.exceptions import ComponentLookupError
# XXX only used for commented-out section below
# from zope.component import getServiceManager, getServiceDefinitions, \
# queryAdapter, getService
-# from zope.component.exceptions import ComponentLookupError
class IntrospectorView(BrowserView):
@@ -26,6 +28,15 @@
introspector = getAdapter(self.context, IIntrospector)
introspector.setRequest(self.request)
return introspector
+
+ def getInterfaceURL(self, name):
+ interfaces = zapi.getService(self.context, Interfaces)
+ try:
+ interfaces.getInterface(name)
+ url = zapi.getView(interfaces, 'absolute_url', self.request)
+ return "%s/detail.html?id=%s" % (url, name)
+ except ComponentLookupError:
+ return ""
def getServicesFor(self):
services = []