schema: fix topic command output

Return topic names as text instead of binary blob.

This fixes ipa help topic display.

https://fedorahosted.org/freeipa/ticket/4739

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Jan Cholasta 2016-06-07 12:51:06 +02:00
parent 3157eec28f
commit 585e0d1b8c
2 changed files with 13 additions and 5 deletions

View File

@ -237,6 +237,8 @@ def _create_topic(schema):
topic['doc'] = ConcatenatedLazyText(schema['doc']) topic['doc'] = ConcatenatedLazyText(schema['doc'])
if 'topic_topic' in schema: if 'topic_topic' in schema:
topic['topic'] = str(schema['topic_topic']) topic['topic'] = str(schema['topic_topic'])
else:
topic['topic'] = None
return topic return topic

View File

@ -248,9 +248,12 @@ class topic_(MetaObject):
object.__setattr__(self, '_topic___topics', topics) object.__setattr__(self, '_topic___topics', topics)
for command in self.api.Command(): for command in self.api.Command():
topic_name = command.topic topic_value = command.topic
if topic_value is None:
continue
topic_name = unicode(topic_value)
while topic_name is not None and topic_name not in topics: while topic_name not in topics:
topic = topics[topic_name] = {'name': topic_name} topic = topics[topic_name] = {'name': topic_name}
for package in self.api.packages: for package in self.api.packages:
@ -267,11 +270,14 @@ class topic_(MetaObject):
topic['doc'] = unicode(module.__doc__).strip() topic['doc'] = unicode(module.__doc__).strip()
try: try:
topic_name = module.topic topic_value = module.topic
except AttributeError: except AttributeError:
topic_name = None continue
else: if topic_value is not None:
topic_name = unicode(topic_value)
topic['topic_topic'] = topic_name topic['topic_topic'] = topic_name
else:
topic.pop('topic_topic', None)
return self.__topics return self.__topics