[Zope3-checkins] CVS: Zope3/src/zope/app/browser - onlinehelp.py:1.10
Stephan Richter
srichter@cosmos.phy.tufts.edu
Tue, 15 Jul 2003 10:20:41 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser
In directory cvs.zope.org:/tmp/cvs-serv27081/src/zope/app/browser
Modified Files:
onlinehelp.py
Log Message:
Fixed the online help to do the right thing (finally). While the interfaces
said it all along, I still expected View classes in the 'view' attribute
of the help:register directive. I now (and should) uses the view name given
to a view.
In the process I also activated the unregister tests.
=== Zope3/src/zope/app/browser/onlinehelp.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/browser/onlinehelp.py:1.9 Tue Jul 1 21:27:58 2003
+++ Zope3/src/zope/app/browser/onlinehelp.py Tue Jul 15 10:20:06 2003
@@ -17,7 +17,10 @@
"""
from zope.interface import providedBy
+from zope.publisher.interfaces.browser import IBrowserPresentation
+
from zope.component import getService, getView
+from zope.component.view import viewService
from zope.publisher.browser import BrowserView
from zope.app.traversing import getRoot
from zope.app.context import ContextWrapper
@@ -53,14 +56,18 @@
self.url = url
self.topic = topic
- view = self.context
- obj = view.context
+ view_class = self.context.__class__
+ obj = self.context.context
help = getService(obj, 'OnlineHelp')
ifaces = providedBy(obj).flattened()
topics = []
- for klass in view.__class__.__bases__ + (view.__class__, None):
- for iface in ifaces:
- for topic in help.getTopicsForInterfaceAndView(iface, klass):
+ for iface in ifaces:
+ specs = viewService.getRegisteredMatching((iface,),
+ IBrowserPresentation)
+ for spec in specs:
+ if spec[2][0] is not view_class:
+ continue
+ for topic in help.getTopicsForInterfaceAndView(iface, spec[4]):
parents = getParents(topic)
path = map(getName, parents[:-1]+[topic])
url = getView(obj, 'absolute_url', self.request)()