Commit b3ab5954 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Do not require empty 'help' directories to be created in Products.

Upon products installation, registerHelp in initializeProduct was first called
with clear=1 for 'help' directory and then clear=0 for 'interfaces' to allow
registering Help for two directories. However, that didn't work if the former
directory does not exist.

Remove such limitation as well as 'help' and 'interfaces' directories which
used to contain dummy files.
Signed-off-by: Julien Muchembled's avatarJulien Muchembled <jm@nexedi.com>
Signed-off-by: Arnaud Fontaine's avatarArnaud Fontaine <arnaud.fontaine@nexedi.com>
parent 645234bd
...@@ -1123,18 +1123,22 @@ def initializeProduct( context, ...@@ -1123,18 +1123,22 @@ def initializeProduct( context,
fti=contentFactoryTypeInformations, fti=contentFactoryTypeInformations,
).initialize( context ) ).initialize( context )
# Register Help and API Reference # Register Help and API Reference. This trick to make registerHelp works
# This trick to make registerHelp work with 2 directories is taken from # with 2 directories was taken originally from CMFCore, but it required at
# CMFCore # least a (possibly) help directory...
help = context.getProductHelp() help = context.getProductHelp()
lastRegistered = help.lastRegistered lastRegistered = help.lastRegistered
context.registerHelp(directory='help', clear=1)
context.registerHelp(directory='interfaces', clear=1) help_list = []
if help.lastRegistered != lastRegistered: for d in 'help', 'interfaces':
help.lastRegistered = None if os.path.exists(os.path.join(this_module.__path__[0], d)):
context.registerHelp(directory='help', clear=1) context.registerHelp(directory=d, clear=1)
help.lastRegistered = None help_list.append(d)
context.registerHelp(directory='interfaces', clear=0)
if help.lastRegistered != lastRegistered and len(help_list) > 1:
for i, d in enumerate(help_list):
help.lastRegistered = None
context.registerHelp(directory=d, clear=not i)
context.registerHelpTitle('%s Help' % product_name) context.registerHelpTitle('%s Help' % product_name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment