[Zope-Checkins] SVN: Zope/trunk/ Removed the old help system, in favor of the current Sphinx documentation hosted at http://docs.zope.org/zope2/. For backwards compatibility the `registerHelp` and `registerHelpTitle` methods are still available on the ProductContext used during the `initialize` function.

Hanno Schlichting hannosch at hannosch.eu
Sat Jul 2 14:26:53 EDT 2011


Log message for revision 122066:
  Removed the old help system, in favor of the current Sphinx documentation hosted at http://docs.zope.org/zope2/. For backwards compatibility the `registerHelp` and `registerHelpTitle` methods are still available on the ProductContext used during the `initialize` function.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/App/FactoryDispatcher.py
  U   Zope/trunk/src/App/ProductContext.py
  U   Zope/trunk/src/App/dtml/manage_form_title.dtml
  U   Zope/trunk/src/App/dtml/manage_tabs.dtml
  D   Zope/trunk/src/HelpSys/
  U   Zope/trunk/src/OFS/Application.py
  U   Zope/trunk/src/OFS/deprecated.zcml
  U   Zope/trunk/src/OFS/interfaces.py
  U   Zope/trunk/src/OFS/misc_.py
  U   Zope/trunk/src/Products/PageTemplates/ZopePageTemplate.py
  D   Zope/trunk/src/Products/PageTemplates/help/
  U   Zope/trunk/src/Products/Sessions/__init__.py
  D   Zope/trunk/src/Products/Sessions/help/
  U   Zope/trunk/src/Products/SiteAccess/__init__.py
  D   Zope/trunk/src/Products/SiteAccess/help/
  U   Zope/trunk/src/Products/TemporaryFolder/__init__.py
  D   Zope/trunk/src/Products/TemporaryFolder/help/
  U   Zope/trunk/src/Products/Transience/__init__.py
  D   Zope/trunk/src/Products/Transience/help/
  U   Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/doc/CHANGES.rst	2011-07-02 18:26:53 UTC (rev 122066)
@@ -33,6 +33,11 @@
 Restructuring
 +++++++++++++
 
+- Removed the old help system, in favor of the current Sphinx documentation
+  hosted at http://docs.zope.org/zope2/. For backwards compatibility the
+  `registerHelp` and `registerHelpTitle` methods are still available on the
+  ProductContext used during the `initialize` function.
+
 - Removed various persistent product related code and options. The
   `enable-product-installation` `zope.conf` setting is now a no-op.
 

Modified: Zope/trunk/src/App/FactoryDispatcher.py
===================================================================
--- Zope/trunk/src/App/FactoryDispatcher.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/App/FactoryDispatcher.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -67,12 +67,6 @@
         "Return the destination for factory output"
         return self
 
-    def getProductHelp(self):
-        """Returns the ProductHelp object associated with the Product.
-        """
-        from HelpSys.HelpSys import ProductHelp
-        return ProductHelp('Help', self.id).__of__(self)
-
 InitializeClass(Product)
 
 

Modified: Zope/trunk/src/App/ProductContext.py
===================================================================
--- Zope/trunk/src/App/ProductContext.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/App/ProductContext.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -15,16 +15,10 @@
 
 from logging import getLogger
 import os
-import re
-import stat
 
 from AccessControl.Permission import registerPermissions
 from AccessControl.PermissionRole import PermissionRole
-from App.Common import package_home
 from App.ImageFile import ImageFile
-from DateTime.DateTime import DateTime
-from HelpSys import APIHelpTopic
-from HelpSys import HelpTopic
 from OFS.misc_ import Misc_
 from OFS.misc_ import misc_
 from OFS.ObjectManager import ObjectManager
@@ -48,8 +42,6 @@
 
     def __init__(self, product, app, package):
         self.__prod = product
-        # app is None by default which signals disabled product installation
-        self.__app = app
         self.__pack = package
 
     def registerClass(self, instance_class=None, meta_type='',
@@ -223,107 +215,18 @@
                 setattr(misc_, pid, Misc_(pid, {}))
             getattr(misc_, pid)[name]=icon
 
-    def getProductHelp(self):
-        """
-        Returns the ProductHelp associated with the current Product.
-        """
-        if self.__app is None:
-            return self.__prod.getProductHelp()
-        return self.__prod.__of__(self.__app.Control_Panel.Products).getProductHelp()
+    def registerHelp(self, directory=None, clear=None, title_re=None):
+        pass
 
-    def registerHelpTopic(self, id, topic):
-        """
-        Register a Help Topic for a product.
-        """
-        self.getProductHelp()._setObject(id, topic)
+    def registerHelpTitle(self, title=None):
+        pass
 
-    def registerHelpTitle(self, title):
-        """
-        Sets the title of the Product's Product Help
-        """
-        h = self.getProductHelp()
-        if getattr(h, 'title', None) != title:
-            h.title = title
+    def getProductHelp(self):
+        class DummyHelp(object):
+            lastRegistered = None
+        return DummyHelp()
 
-    def registerHelp(self, directory='help', clear=1,
-            title_re=re.compile(r'<title>(.+?)</title>', re.I)):
-        """
-        Registers Help Topics for all objects in a directory.
 
-        Nothing will be done if the files in the directory haven't
-        changed since the last registerHelp call.
-
-        'clear' indicates whether or not to delete all existing
-        Topics from the Product.
-
-        HelpTopics are created for these kind of files
-
-        .dtml            -- DTMLHelpTopic
-        .html .htm       -- TextHelpTopic
-        .stx .txt        -- STXHelpTopic
-        .jpg .png .gif   -- ImageHelpTopic
-        .py              -- APIHelpTopic
-        """
-
-        if not self.__app:
-            return
-
-        help=self.getProductHelp()
-        path=os.path.join(package_home(self.__pack.__dict__),
-                          directory)
-
-        # If help directory does not exist, log a warning and return.
-        try:
-            dir_mod_time=DateTime(os.stat(path)[stat.ST_MTIME])
-        except OSError, (errno, text):
-            LOG.warn('%s: %s' % (text, path))
-            return
-
-        # test to see if nothing has changed since last registration
-        if help.lastRegistered is not None and \
-                help.lastRegistered >= dir_mod_time:
-            return
-        help.lastRegistered=DateTime()
-
-        if clear:
-            for id in help.objectIds(['Help Topic','Help Image']):
-                help._delObject(id)
-
-        for file in os.listdir(path):
-            ext=os.path.splitext(file)[1]
-            ext=ext.lower()
-            if ext in ('.dtml',):
-                contents = open(os.path.join(path,file),'rb').read()
-                m = title_re.search(contents)
-                if m:
-                    title = m.group(1)
-                else:
-                    title = ''
-                ht=HelpTopic.DTMLTopic(file, '', os.path.join(path,file))
-                self.registerHelpTopic(file, ht)
-            elif ext in ('.html', '.htm'):
-                contents = open(os.path.join(path,file),'rb').read()
-                m = title_re.search(contents)
-                if m:
-                    title = m.group(1)
-                else:
-                    title = ''
-                ht=HelpTopic.TextTopic(file, title, os.path.join(path,file))
-                self.registerHelpTopic(file, ht)
-            elif ext in ('.stx', '.txt'):
-                title=(open(os.path.join(path,file),'rb').readline()).split(':')[0]
-                ht=HelpTopic.STXTopic(file, title, os.path.join(path, file))
-                self.registerHelpTopic(file, ht)
-            elif ext in ('.jpg', '.gif', '.png'):
-                ht=HelpTopic.ImageTopic(file, '', os.path.join(path, file))
-                self.registerHelpTopic(file, ht)
-            elif ext in ('.py',):
-                if file[0] == '_': # ignore __init__.py
-                    continue
-                ht=APIHelpTopic.APIHelpTopic(file, '', os.path.join(path, file))
-                self.registerHelpTopic(file, ht)
-
-
 class AttrDict:
 
     def __init__(self, ob):

Modified: Zope/trunk/src/App/dtml/manage_form_title.dtml
===================================================================
--- Zope/trunk/src/App/dtml/manage_form_title.dtml	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/App/dtml/manage_form_title.dtml	2011-07-02 18:26:53 UTC (rev 122066)
@@ -8,13 +8,7 @@
   </td>
   <td align="right" valign="top">
   <div class="std-text">
-  <dtml-if expr="help_topic and help_product">
-    <dtml-if expr="container.HelpSys.helpLink(help_product, help_topic)">
-      <dtml-var "container.HelpSys.helpLink(help_product, help_topic)">
-    </dtml-if>
-  <dtml-else>
   &nbsp;
-  </dtml-if>
   </div>
   </td>
 </tr>

Modified: Zope/trunk/src/App/dtml/manage_tabs.dtml
===================================================================
--- Zope/trunk/src/App/dtml/manage_tabs.dtml	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/App/dtml/manage_tabs.dtml	2011-07-02 18:26:53 UTC (rev 122066)
@@ -126,29 +126,6 @@
     </dtml-if wl_isLocked>
     </div>
     </td>
-  <dtml-if "_.has_key('help_topic') and _.has_key('help_product')">
-  <dtml-if "HelpSys.helpLink(help_product, help_topic)">
-  <td align="right" valign="top">
-  <div class="std-text">
-  <dtml-var "HelpSys.helpLink(help_product, help_topic)">
-  </div>
-  </td>
-  </dtml-if>
-  <dtml-else>
-  <dtml-if manage_options>
-  <dtml-with "_(option=manage_options[a_])">
-  <dtml-if "option.has_key('help')">
-  <dtml-if "HelpSys.helpLink(option['help'][0], option['help'][1])">
-  <td align="right" valign="top">
-  <div class="std-text">
-  <dtml-var "HelpSys.helpLink(option['help'][0], option['help'][1])">
-  </div>
-  </td>
-  </dtml-if>
-  </dtml-if>
-  </dtml-with>
-  </dtml-if>
-  </dtml-if>
   </tr>
   </table>
 

Modified: Zope/trunk/src/OFS/Application.py
===================================================================
--- Zope/trunk/src/OFS/Application.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/OFS/Application.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -27,7 +27,6 @@
 from App.config import getConfiguration
 from App import FactoryDispatcher
 from DateTime import DateTime
-from HelpSys.HelpSys import HelpSys
 from OFS.metaconfigure import get_packages_to_initialize
 from OFS.metaconfigure import package_initialized
 from OFS.userfolder import UserFolder
@@ -65,10 +64,6 @@
     web__form__method = 'GET'
     isTopLevelPrincipiaApplicationObject = 1
 
-    # Create the help system object
-    HelpSys = HelpSys('HelpSys')
-
-
     manage_options=((
             Folder.Folder.manage_options[0],
             Folder.Folder.manage_options[1],

Modified: Zope/trunk/src/OFS/deprecated.zcml
===================================================================
--- Zope/trunk/src/OFS/deprecated.zcml	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/OFS/deprecated.zcml	2011-07-02 18:26:53 UTC (rev 122066)
@@ -5,9 +5,6 @@
       class="OFS.userfolder.BasicUserFolder"/>
 
   <five:deprecatedManageAddDelete
-      class="HelpSys.HelpTopic.HelpTopicBase"/>
-
-  <five:deprecatedManageAddDelete
       class="OFS.Cache.CacheManager"/>
 
   <five:deprecatedManageAddDelete

Modified: Zope/trunk/src/OFS/interfaces.py
===================================================================
--- Zope/trunk/src/OFS/interfaces.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/OFS/interfaces.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -841,8 +841,6 @@
         title=u"Is top level Principa application object",
         )
 
-    HelpSys = Attribute("Help system")
-
     p_ = Attribute(""" """)
     misc_ = Attribute("Misc.")
 

Modified: Zope/trunk/src/OFS/misc_.py
===================================================================
--- Zope/trunk/src/OFS/misc_.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/OFS/misc_.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -73,11 +73,6 @@
     Properties_icon = ImageFile('www/Properties_icon.gif', ofs_dir)
     Propertysheets_icon = ImageFile('www/Properties_icon.gif', ofs_dir)
 
-    import HelpSys
-    helpsys_dir = dirname(HelpSys.__file__)
-    ProductHelp_icon=ImageFile('images/productHelp.gif', helpsys_dir)
-    HelpTopic_icon=ImageFile('images/helpTopic.gif', helpsys_dir)
-
 InitializeClass(p_)
 
 

Modified: Zope/trunk/src/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/trunk/src/Products/PageTemplates/ZopePageTemplate.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/Products/PageTemplates/ZopePageTemplate.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -501,6 +501,3 @@
                       manage_addPageTemplate),
         icon='www/zpt.gif',
         )
-    context.registerHelp()
-    context.registerHelpTitle('Zope Help')
-

Modified: Zope/trunk/src/Products/Sessions/__init__.py
===================================================================
--- Zope/trunk/src/Products/Sessions/__init__.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/Products/Sessions/__init__.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -36,9 +36,6 @@
                       SessionDataManager.constructSessionDataManager)
         )
 
-    context.registerHelp()
-    context.registerHelpTitle("Zope Help")
-
     # do module security declarations so folks can use some of the
     # module-level stuff in PythonScripts
     #

Modified: Zope/trunk/src/Products/SiteAccess/__init__.py
===================================================================
--- Zope/trunk/src/Products/SiteAccess/__init__.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/Products/SiteAccess/__init__.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -18,5 +18,3 @@
       permission='Add Virtual Host Monsters',
       constructors=VirtualHostMonster.constructors,
       icon='www/VirtualHostMonster.gif')
-
-    context.registerHelp()

Modified: Zope/trunk/src/Products/TemporaryFolder/__init__.py
===================================================================
--- Zope/trunk/src/Products/TemporaryFolder/__init__.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/Products/TemporaryFolder/__init__.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -31,6 +31,3 @@
                       TemporaryFolder.constructTemporaryFolder),
         visibility=0 # dont show this in the add list for 2.7+ (use dbtab)
         )
-
-    context.registerHelp()
-    context.registerHelpTitle('Zope Help')

Modified: Zope/trunk/src/Products/Transience/__init__.py
===================================================================
--- Zope/trunk/src/Products/Transience/__init__.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/Products/Transience/__init__.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -29,5 +29,3 @@
         constructors=(Transience.constructTransientObjectContainerForm,
                       Transience.constructTransientObjectContainer)
         )
-    context.registerHelp()
-    context.registerHelpTitle('Zope Help')

Modified: Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py
===================================================================
--- Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py	2011-07-02 18:08:30 UTC (rev 122065)
+++ Zope/trunk/src/Testing/ZopeTestCase/ZopeLite.py	2011-07-02 18:26:53 UTC (rev 122066)
@@ -119,14 +119,6 @@
     def null_initialize(app): pass
     OFS.Application.initialize = null_initialize
 
-    # Avoid expensive help registration
-    def null_register_topic(self,id,topic): pass
-    App.ProductContext.ProductContext.registerHelpTopic = null_register_topic
-    def null_register_title(self,title): pass
-    App.ProductContext.ProductContext.registerHelpTitle = null_register_title
-    def null_register_help(self,directory='',clear=1,title_re=None): pass
-    App.ProductContext.ProductContext.registerHelp = null_register_help
-
     # Avoid loading any ZCML
     from Zope2.App import startup as zopeapp_startup
     def null_load_zcml(): pass



More information about the Zope-Checkins mailing list