summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2011-08-24 17:27:32 -0400
committerRob Crittenden <rcritten@redhat.com>2011-08-24 23:05:17 -0400
commita4fadbfe632ab9629df7042825f90c73b29b3aa2 (patch)
tree609646754ffff3273bd1f70d785031a3d5e9b292 /ipalib/cli.py
parentf4ad749126f025769113dc3f605196f2c08f1bb1 (diff)
downloadfreeipa-a4fadbfe632ab9629df7042825f90c73b29b3aa2.tar.gz
freeipa-a4fadbfe632ab9629df7042825f90c73b29b3aa2.tar.xz
freeipa-a4fadbfe632ab9629df7042825f90c73b29b3aa2.zip
ticket 1705 - internationalize help topics
* Wrap each topic description in _() * Replace the use of if 'topic' in dir(module) with the more Pythonic and efficient getattr(module, 'topic', None) * Make sure to invoke unicode on the value returned from _() otherwise you'll get a GettextFactory instance, not a string * Clean up trailing whitespace errors
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 536fe2ecb..99416c90a 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -674,10 +674,8 @@ class help(frontend.Local):
__import__(module_name)
module = sys.modules[module_name]
- dir_list = dir(module)
- if 'topic' in dir_list:
- topic = module.topic
- else:
+ topic = getattr(module, 'topic', None)
+ if topic is None:
topic = (self._get_command_module(module_name), None)
return topic
@@ -728,7 +726,7 @@ class help(frontend.Local):
mcl = max((self._topics[topic_name][2][mod_name][1], len(c.name)))
self._topics[topic_name][2][mod_name][1] = mcl
else:
- self._topics[topic_name] = [topic[1], 0, {mod_name: [doc, 0, [c]]}]
+ self._topics[topic_name] = [unicode(_(topic[1])), 0, {mod_name: [doc, 0, [c]]}]
self._count_topic_mcl(topic_name, mod_name)
else:
self._builtins.append(c)