|
|
590d18 |
From 6ed7f2846c04c5b6a570787b8022797c279aaaee Mon Sep 17 00:00:00 2001
|
|
|
590d18 |
From: Petr Vobornik <pvoborni@redhat.com>
|
|
|
590d18 |
Date: Tue, 25 Aug 2015 16:26:00 +0200
|
|
|
590d18 |
Subject: [PATCH] fix missing information in object metadata
|
|
|
590d18 |
|
|
|
590d18 |
Missing 'required' values in takes_params causes Web UI to treat required
|
|
|
590d18 |
fields as optional.
|
|
|
590d18 |
|
|
|
590d18 |
Regression caused by ba0a1c6b33e2519a48754602413c8379fb1f0ff1
|
|
|
590d18 |
|
|
|
590d18 |
https://fedorahosted.org/freeipa/ticket/5258
|
|
|
590d18 |
|
|
|
590d18 |
Reviewed-By: Martin Basti <mbasti@redhat.com>
|
|
|
590d18 |
---
|
|
|
590d18 |
ipalib/parameters.py | 17 ++++++++++++++---
|
|
|
590d18 |
1 file changed, 14 insertions(+), 3 deletions(-)
|
|
|
590d18 |
|
|
|
590d18 |
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
|
|
|
590d18 |
index 6cc6f8c9244abb9e895782f40cbdde63b2144d22..5ced5067ed2657962c35d7d675c4ddd822df6a36 100644
|
|
|
590d18 |
--- a/ipalib/parameters.py
|
|
|
590d18 |
+++ b/ipalib/parameters.py
|
|
|
590d18 |
@@ -922,12 +922,23 @@ class Param(ReadOnly):
|
|
|
590d18 |
|
|
|
590d18 |
def __json__(self):
|
|
|
590d18 |
json_dict = {}
|
|
|
590d18 |
- for key in self.__kw:
|
|
|
590d18 |
- json_dict[key] = json_serialize(self.__kw[key])
|
|
|
590d18 |
+ for (a, k, d) in self.kwargs:
|
|
|
590d18 |
+ if k in (callable, DefaultFrom):
|
|
|
590d18 |
+ continue
|
|
|
590d18 |
+ elif isinstance(getattr(self, a), frozenset):
|
|
|
590d18 |
+ json_dict[a] = [k for k in getattr(self, a, [])]
|
|
|
590d18 |
+ else:
|
|
|
590d18 |
+ val = getattr(self, a, '')
|
|
|
590d18 |
+ if val is None:
|
|
|
590d18 |
+ # ignore 'not set' because lack of their presence is
|
|
|
590d18 |
+ # the information itself
|
|
|
590d18 |
+ continue
|
|
|
590d18 |
+ json_dict[a] = json_serialize(val)
|
|
|
590d18 |
+
|
|
|
590d18 |
json_dict['class'] = self.__class__.__name__
|
|
|
590d18 |
json_dict['name'] = self.name
|
|
|
590d18 |
json_dict['type'] = self.type.__name__
|
|
|
590d18 |
- json_dict['flags'] = json_serialize([f for f in self.flags])
|
|
|
590d18 |
+
|
|
|
590d18 |
return json_dict
|
|
|
590d18 |
|
|
|
590d18 |
|
|
|
590d18 |
--
|
|
|
590d18 |
2.4.3
|
|
|
590d18 |
|