[Zope3-checkins] CVS: Zope3/src/zope/app/browser - onlinehelp.py:1.17 onlinehelp.zcml:1.12

Jim Fulton cvs-admin at zope.org
Fri Nov 21 12:10:17 EST 2003


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

Modified Files:
	onlinehelp.py onlinehelp.zcml 
Log Message:
Kept but commented out old FindRelevantHelpTopics class, and partially
modified it to reflect recent changes. It's not used anymore, because
it was wildly ineffecient.


=== Zope3/src/zope/app/browser/onlinehelp.py 1.16 => 1.17 ===
--- Zope3/src/zope/app/browser/onlinehelp.py:1.16	Thu Oct 16 06:15:45 2003
+++ Zope3/src/zope/app/browser/onlinehelp.py	Fri Nov 21 12:10:16 2003
@@ -17,10 +17,7 @@
 """
 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.app.publisher.browser import BrowserView
 from zope.app.traversing import getRoot
 from zope.app.traversing import getParents, getName
@@ -42,3 +39,39 @@
         onlinehelp = getRoot(self.context)
         return self._makeSubTree(onlinehelp)
 
+# XXX The view below is highly qeustionable on many levels.
+# - It uses the global view service (now refactored to presentation service
+# - It's very expensive.
+# Perhaps we'll resurrect this later when we have time to do it bit better.
+
+## class FindRelevantHelpTopics(BrowserView):
+##     """This object is used as a view on a view, so that we can get all the
+##     required information."""
+
+##     def __call__(self):
+
+##         class FindResult:
+##             def __init__(self, url, topic):
+##                 self.url = url
+##                 self.topic = topic
+
+##         view_class = self.context.__class__
+##         obj = self.context.context
+##         help = getService(obj, 'OnlineHelp')
+##         ifaces = providedBy(obj).flattened()
+##         topics = []
+##         for iface in ifaces:
+##             specs = viewService.getRegisteredMatching((iface,),
+##                                                       IBrowserRequest)
+##             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, [topic]+parents[:-1]) 
+##                     path.reverse()
+##                     url = getView(obj, 'absolute_url', self.request)()
+##                     url += '/++help++/++skin++Onlinehelp/'+'/'.join(path)
+##                     topics.append(FindResult(url, topic))
+        
+##         return topics


=== Zope3/src/zope/app/browser/onlinehelp.zcml 1.11 => 1.12 ===
--- Zope3/src/zope/app/browser/onlinehelp.zcml:1.11	Thu Oct 16 06:15:45 2003
+++ Zope3/src/zope/app/browser/onlinehelp.zcml	Fri Nov 21 12:10:16 2003
@@ -2,6 +2,16 @@
   xmlns:zope="http://namespaces.zope.org/zope"
   xmlns="http://namespaces.zope.org/browser">
 
+<!--
+  <page
+      name="find_help_topics"
+      for="*"
+      class=".onlinehelp.FindRelevantHelpTopics"
+      permission="zope.Public"
+      allowed_attributes="__call__" />
+
+-->
+
   <pages
       for="zope.app.interfaces.onlinehelp.IOnlineHelpTopic"
       permission="zope.Public"




More information about the Zope3-Checkins mailing list