From 6aadeb9aea60165d9c68b348dae4df456b00dfc4 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 22 Jan 2009 09:58:35 -0700 Subject: Added Object.params_minus() method; various small tweaks --- ipalib/frontend.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'ipalib/frontend.py') diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 640b01f92..67f0a89c2 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -27,7 +27,7 @@ import plugable from plugable import lock, check_name import errors from errors import check_type, check_isinstance, raise_TypeError -from parameters import create_param, Param, Str, Flag +from parameters import create_param, Param, Str, Flag, Password from util import make_repr from errors2 import ZeroArgumentError, MaxArgumentError, OverlapError @@ -102,6 +102,7 @@ class Command(plugable.Plugin): params.update(self.get_default(**params)) self.validate(**params) (args, options) = self.params_2_args_options(**params) + self.debug(make_repr(self.name, *args, **options)) result = self.run(*args, **options) self.debug('%s result: %r', self.name, result) return result @@ -447,6 +448,18 @@ class Object(plugable.Plugin): if 'Backend' in self.api and self.backend_name in self.api.Backend: self.backend = self.api.Backend[self.backend_name] + def params_minus(self, *names): + """ + Yield all Param whose name is not in ``names``. + """ + if len(names) == 1 and not isinstance(names[0], (Param, str)): + names = names[0] + minus = frozenset(names) + for param in self.params(): + if param.name in minus or param in minus: + continue + yield param + def get_dn(self, primary_key): """ Construct an LDAP DN from a primary_key. -- cgit