Zope’s Built-In Help System
Friday, 9 September 2005
Zope comes with a default help system that looks pretty dated. Here’s some tips how to integrate it with your Zope installation, and make it nice and fresh.
First some background, all Zope products have a “getProductHelp” method (see App/Product.py), this returns the a folderish object called Help. If you go into the Control Panel/Products, you should be able to see the Help folder under each Product. You can add help documents inside through the web, or you can initialize it using context.registerHelp(). Here’s how:
- Create a help subdirectory under your product directory, i.e. Products/MyProduct/help. Make sure it is in lowercase.
- Create some help files with extensions dtml, or stx (these are just plain text files).
- In Products/MyProduct/__init__.py write this:
def initialize(context):
context.registerClass(
...,
permission='...',
constructors=(...,
...),
icon='www/....gif',
)
context.registerHelp()
context.registerHelpTitle(...)
Now for skinning:
- Subclass HelpSys/HelpSys, and
- override helpValues, and only return a list of ProductHelp that you wish to expose
def helpValues(self, spec=None): hv = [] for productName in ['myProduct1', 'myProduct2']: product = getattr(self.Control_Panel.Products, productName) productHelp = product.getProductHelp() if productHelp.helpValues(): hv.append(productHelp) return hv - Replace index_html, standard_help_header, standard_help_footer with your own dtml files
index_html = Globals.DTMLFile('dtml/help', globals()) standard_help_header = Globals.DTMLFile('dtml/standard_help_header', globals()) standard_help_footer = Globals.DTMLFile('dtml/standard_help_footer', globals())