diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-12 17:42:21 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-12 17:42:21 +0000 |
commit | 7bbeb2db69ffec5a0372e614a3b7eb5194e3b773 (patch) | |
tree | eb98cb5db77683e13b43b32ee5fa34ec8875fc38 /ipalib/public.py | |
parent | 99d7638ff5c5cddb4f23d25ad13ef122476d5679 (diff) | |
download | freeipa.git-7bbeb2db69ffec5a0372e614a3b7eb5194e3b773.tar.gz freeipa.git-7bbeb2db69ffec5a0372e614a3b7eb5194e3b773.tar.xz freeipa.git-7bbeb2db69ffec5a0372e614a3b7eb5194e3b773.zip |
116: Added a user_initials property plugin to demostrate default() method
Diffstat (limited to 'ipalib/public.py')
-rw-r--r-- | ipalib/public.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ipalib/public.py b/ipalib/public.py index c1e644d5..86323822 100644 --- a/ipalib/public.py +++ b/ipalib/public.py @@ -184,6 +184,7 @@ class cmd(plugable.Plugin): yield (key, value) def normalize(self, **kw): + self.print_call('normalize', kw) return dict(self.normalize_iter(kw)) def default_iter(self, kw): @@ -194,29 +195,32 @@ class cmd(plugable.Plugin): yield(option.name, value) def default(self, **kw): + self.print_call('default', kw) return dict(self.default_iter(kw)) def validate(self, **kw): + self.print_call('validate', kw) for (key, value) in kw.items(): if key in self.options: self.options[key].validate(value) def execute(self, **kw): + self.print_call('execute', kw) pass - def print_n_call(self, method, kw): + def print_call(self, method, kw): print '%s.%s(%s)' % ( self.name, method, ', '.join('%s=%r' % (k, v) for (k, v) in kw.items()), ) - return getattr(self, method)(**kw) def __call__(self, **kw): - kw = self.print_n_call('normalize', kw) - kw.update(self.print_n_call('default', kw)) - self.print_n_call('validate', kw) - return self.print_n_call('execute', kw) + self.print_call('__call__', kw) + kw = self.normalize(**kw) + kw.update(self.default(**kw)) + self.validate(**kw) + self.execute(**kw) class obj(plugable.Plugin): |