diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-22 18:48:21 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-03 15:29:01 -0500 |
commit | 244346dbcbe999bb921ee792ddc2ac222532cc56 (patch) | |
tree | 5c6e88a733cb9e304e03a37a792df0358b7f54b4 /ipalib/frontend.py | |
parent | 833088955c0e6c606bc8ea96a05ddf6c3a34bc6b (diff) | |
download | freeipa-244346dbcbe999bb921ee792ddc2ac222532cc56.tar.gz freeipa-244346dbcbe999bb921ee792ddc2ac222532cc56.tar.xz freeipa-244346dbcbe999bb921ee792ddc2ac222532cc56.zip |
More work on xmlrpc stuff, started migrated more code to use errors2 instead of errors
Diffstat (limited to 'ipalib/frontend.py')
-rw-r--r-- | ipalib/frontend.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 6efccbb4d..565060b5d 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -97,17 +97,28 @@ class Command(plugable.Plugin): XML-RPC and the executed an the nearest IPA server. """ params = self.args_options_2_params(*args, **options) + self.info( + '%s(%s)', self.name, ', '.join(self.__repr_iter(params)) + ) params = self.normalize(**params) params = self.convert(**params) params.update(self.get_default(**params)) self.validate(**params) (args, options) = self.params_2_args_options(**params) - # FIXME: don't log passords! - self.info(make_repr(self.name, *args, **options)) result = self.run(*args, **options) - self.debug('%s result: %r', self.name, result) + self.debug('result from %s(): %r', self.name, result) return result + def __repr_iter(self, params): + for arg in self.args(): + value = params.get(arg.name, None) + yield '%r' % (arg.safe_value(value),) + for option in self.options(): + if option.name not in params: + continue + value = params[option.name] + yield '%s=%r' % (option.name, option.safe_value(value)) + def args_options_2_params(self, *args, **options): """ Merge (args, options) into params. @@ -245,10 +256,7 @@ class Command(plugable.Plugin): """ for param in self.params(): value = kw.get(param.name, None) - if value is not None: - param.validate(value) - elif param.required: - raise errors.RequirementError(param.name) + param.validate(value) def run(self, *args, **options): """ |