summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2015-08-25 16:26:00 +0200
committerMartin Basti <mbasti@redhat.com>2015-08-26 13:01:52 +0200
commitd01f18d4417e3073f31981dedfc8a200b3a42eb9 (patch)
treedb65d6df75b781923c330319035b41f4412c1b4b
parent14a87632e5df30dd2b44a1ca49e6b308d2249c70 (diff)
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>
-rw-r--r--ipalib/parameters.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 6139fe8d8..f9da3b0f5 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -923,12 +923,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