schema: remove redundant information

Remove the `autofill` kwarg from param schema. On the server, include
default value only if autofill is set. On the client, set autofill if param
has a default value.

Remove the `deprecated_cli_aliases`, `hint` and `sortorder` kwargs, and the
`dnsrecord_extra`, `dnsrecord_part` and `suppress_empty` flags from param
schema, as they are now handled exclusively on the client.

Replace the `no_option` and `no_output` flags in param schema with
exclusion of the param in 'cli' and 'webui' contexts.

Remove the `no_display` flag from output schema, as it is now handled
exclusively on the client.

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

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Jan Cholasta
2016-06-08 16:24:45 +02:00
parent d0cfe37a7e
commit cbe73c6d28
3 changed files with 23 additions and 90 deletions

View File

@@ -223,25 +223,20 @@ def _create_param(meta):
'sortorder'):
kwargs[key] = value
elif key in ('cli_metavar',
'cli_name',
'hint'):
'cli_name'):
kwargs[key] = str(value)
elif key == 'confirm' and issubclass(cls, parameters.Password):
kwargs[key] = value
elif key == 'default':
default = value
kwargs['autofill'] = True
elif key == 'default_from_param':
kwargs['default_from'] = DefaultFrom(_nope,
*(str(k) for k in value))
elif key in ('deprecated_cli_aliases',
'exclude',
kwargs['autofill'] = True
elif key in ('exclude',
'include'):
kwargs[key] = tuple(str(v) for v in value)
elif key in ('dnsrecord_extra',
'dnsrecord_part',
'no_option',
'suppress_empty') and value:
kwargs.setdefault('flags', set()).add(key)
if default is not None:
tmp = cls(str(meta['name']), **dict(kwargs, no_convert=False))