Changed CLI to allow to use FILE as optional param

This commit is contained in:
Martin Basti 2013-10-21 09:45:21 +02:00 committed by Petr Viktorin
parent db3e450732
commit db7dbbb141

View File

@ -1254,11 +1254,13 @@ class cli(backend.Executioner):
raise ValidationError(
name=to_cli(p.cli_name), error=e[1]
)
if not raw:
raise ValidationError(
name=to_cli(p.cli_name), error=_('No file to read')
)
kw[p.name] = self.Backend.textui.decode(raw)
if raw:
kw[p.name] = self.Backend.textui.decode(raw)
elif p.required:
raise ValidationError(
name=to_cli(p.cli_name), error=_('No file to read')
)
class IPAHelpFormatter(optparse.IndentedHelpFormatter):