diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2015-08-25 16:26:00 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2015-08-26 13:01:52 +0200 |
commit | 42e8ab8c39c24fa9dca2d7a6dc4f75b7ae6e8b9a (patch) | |
tree | e262af65eff25c7f4be5eaa4163438dc457f8d04 /ipalib | |
parent | e247babc1ad211f7c939029cfb57eb6f4fbd79ab (diff) | |
download | freeipa-42e8ab8c39c24fa9dca2d7a6dc4f75b7ae6e8b9a.tar.gz freeipa-42e8ab8c39c24fa9dca2d7a6dc4f75b7ae6e8b9a.tar.xz freeipa-42e8ab8c39c24fa9dca2d7a6dc4f75b7ae6e8b9a.zip |
fix missing information in object metadata
Missing 'required' values in takes_params causes Web UI to treat required
fields as optional.
Regression caused by ba0a1c6b33e2519a48754602413c8379fb1f0ff1
https://fedorahosted.org/freeipa/ticket/5258
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/parameters.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 6cc6f8c92..5ced5067e 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -922,12 +922,23 @@ class Param(ReadOnly): def __json__(self): json_dict = {} - for key in self.__kw: - json_dict[key] = json_serialize(self.__kw[key]) + for (a, k, d) in self.kwargs: + 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: + # ignore 'not set' because lack of their presence is + # the information itself + continue + json_dict[a] = json_serialize(val) + 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 |