Fix show_api command

This commit is contained in:
Jakub Hrozek 2008-12-17 17:21:25 -07:00 committed by Jason Gerard DeRose
parent f0bbe1b5a0
commit 360f95341a
2 changed files with 6 additions and 3 deletions

View File

@ -443,11 +443,11 @@ class show_api(frontend.Application):
else:
for name in namespaces:
if name not in self.api:
exit_error('api has no such namespace: %s' % name)
raise errors.NoSuchNamespaceError(name)
names = namespaces
lines = self.__traverse(names)
ml = max(len(l[1]) for l in lines)
self.print_name()
self.Backend.textui.print_name('run')
first = True
for line in lines:
if line[0] == 0 and not first:
@ -463,7 +463,7 @@ class show_api(frontend.Application):
s = '1 attribute shown.'
else:
s = '%d attributes show.' % len(lines)
self.print_dashed(s)
self.Backend.textui.print_dashed(s)
def __traverse(self, names):

View File

@ -117,6 +117,9 @@ class InvocationError(IPAError):
class UnknownCommandError(InvocationError):
format = 'unknown command "%s"'
class NoSuchNamespaceError(InvocationError):
format = 'api has no such namespace: %s'
def _(text):
return text