mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Help plugin: don't fail if a topic's module is not found
Previously the help plugin failed when searching for the docstring when a topic's module was not found. This can happen when some server plugins are loaded (e.g. for tests). Use empty documentation when the topic is not found.
This commit is contained in:
parent
15618beab6
commit
dadf7cddf0
@ -722,9 +722,14 @@ class help(frontend.Local):
|
||||
self._topics[topic_name][2].append(c)
|
||||
else:
|
||||
m = '%s.%s' % (self._PLUGIN_BASE_MODULE, topic_name)
|
||||
doc = (
|
||||
unicode(_(sys.modules[m].__doc__)) or ''
|
||||
).strip().split('\n', 1)[0]
|
||||
try:
|
||||
module = sys.modules[m]
|
||||
except KeyError:
|
||||
doc = ''
|
||||
else:
|
||||
doc = (
|
||||
unicode(_(module.__doc__)) or ''
|
||||
).strip().split('\n', 1)[0]
|
||||
self._topics[topic_name] = [doc, 0, [c]]
|
||||
mcl = max((self._topics[topic_name][1], len(c.name)))
|
||||
self._topics[topic_name][1] = mcl
|
||||
|
Loading…
Reference in New Issue
Block a user