diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2015-06-05 15:11:54 +0200 |
---|---|---|
committer | Tomas Babej <tbabej@redhat.com> | 2015-07-03 10:42:16 +0200 |
commit | ba0a1c6b33e2519a48754602413c8379fb1f0ff1 (patch) | |
tree | c9229fb3174ec5a0c76425746db199ada986e943 /ipalib/parameters.py | |
parent | 884afb5d38480e23c91ec14876bcf39151a2c2ed (diff) | |
download | freeipa-ba0a1c6b33e2519a48754602413c8379fb1f0ff1.tar.gz freeipa-ba0a1c6b33e2519a48754602413c8379fb1f0ff1.tar.xz freeipa-ba0a1c6b33e2519a48754602413c8379fb1f0ff1.zip |
include more information in metadata
added to commands: doc, proper args, NO_CLI
added to options: default_from, cli_name, cli_short_name and others
https://fedorahosted.org/freeipa/ticket/3129
Reviewed-By: Martin Kosek <mkosek@redhat.com>
Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipalib/parameters.py')
-rw-r--r-- | ipalib/parameters.py | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 7fa55fd6a..6cc6f8c92 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -240,6 +240,9 @@ class DefaultFrom(ReadOnly): except StandardError: pass + def __json__(self): + return self.keys + def parse_param_spec(spec): """ @@ -917,30 +920,14 @@ class Param(ReadOnly): def sort_key(self, value): return value - json_exclude_attrs = ( - 'alwaysask', 'autofill', 'cli_name', 'cli_short_name', 'csv', - 'sortorder', 'falsehoods', 'truths', 'version', - ) - def __json__(self): json_dict = {} - for (a, k, d) in self.kwargs: - if a in self.json_exclude_attrs: - continue - if k in (callable, DefaultFrom): - continue - elif isinstance(getattr(self, a), frozenset): - json_dict[a] = [k for k in getattr(self, a, [])] - else: - val = getattr(self, a, '') - if val is None or val is False: - # ignore False and not set because lack of their presence is - # the information itself - continue; - json_dict[a] = json_serialize(val) + for key in self.__kw: + json_dict[key] = json_serialize(self.__kw[key]) json_dict['class'] = self.__class__.__name__ json_dict['name'] = self.name json_dict['type'] = self.type.__name__ + json_dict['flags'] = json_serialize([f for f in self.flags]) return json_dict |