summaryrefslogtreecommitdiffstats
path: root/ipalib/frontend.py
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2014-03-27 14:04:00 +0100
committerPetr Viktorin <pviktori@redhat.com>2014-04-18 14:59:20 +0200
commit4314d02fbf9ef1cb9543ecf76a8d22e79d250214 (patch)
tree8c6ac601e881712e8cf7c25fce420026a3762553 /ipalib/frontend.py
parentc644b47492e22370bc71f57e5ac46b50f9b4e247 (diff)
downloadfreeipa-4314d02fbf9ef1cb9543ecf76a8d22e79d250214.tar.gz
freeipa-4314d02fbf9ef1cb9543ecf76a8d22e79d250214.tar.xz
freeipa-4314d02fbf9ef1cb9543ecf76a8d22e79d250214.zip
Allow primary keys to use different type than unicode.
Also return list of primary keys instead of a single unicode CSV value from LDAPDelete-based commands. This introduces a new capability 'primary_key_types' for backward compatibility with old clients. Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipalib/frontend.py')
-rw-r--r--ipalib/frontend.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 76c53eba5..66be7939f 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -439,12 +439,9 @@ class Command(HasParam):
and 'summary' in self.output
and 'summary' not in ret
):
- if self.msg_summary:
- ret['summary'] = self.msg_summary % ret
- else:
- ret['summary'] = None
+ ret['summary'] = self.get_summary_default(ret)
if self.use_output_validation and (self.output or ret is not None):
- self.validate_output(ret)
+ self.validate_output(ret, options.get('version', API_VERSION))
return ret
def soft_validate(self, values):
@@ -918,7 +915,7 @@ class Command(HasParam):
flags=['no_option', 'no_output'],
)
- def validate_output(self, output):
+ def validate_output(self, output, version=API_VERSION):
"""
Validate the return value to make sure it meets the interface contract.
"""
@@ -947,7 +944,7 @@ class Command(HasParam):
nice, o.name, o.type, type(value), value)
)
if callable(o.validate):
- o.validate(self, value)
+ o.validate(self, value, version)
def get_output_params(self):
for param in self._get_param_iterable('output_params', verb='has'):
@@ -959,6 +956,10 @@ class Command(HasParam):
continue
yield param
+ def get_summary_default(self, output):
+ if self.msg_summary:
+ return self.msg_summary % output
+
def log_messages(self, output, logger):
logger_functions = dict(
debug=logger.debug,