diff options
author | Jan Cholasta <jcholast@redhat.com> | 2012-04-19 08:06:32 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-04-26 09:00:30 +0200 |
commit | 3ba9cc8eb42c22e1a5b205b6933e3110d2cbd36c (patch) | |
tree | 5d9025bddb28f6be6aecf853e37d13aa1b78dc0f /ipalib/plugins/pwpolicy.py | |
parent | 856b9627beaca89fde6904cdea398ac817faf321 (diff) | |
download | freeipa-3ba9cc8eb42c22e1a5b205b6933e3110d2cbd36c.tar.gz freeipa-3ba9cc8eb42c22e1a5b205b6933e3110d2cbd36c.tar.xz freeipa-3ba9cc8eb42c22e1a5b205b6933e3110d2cbd36c.zip |
Refactor exc_callback invocation.
Replace _call_exc_callbacks with a function wrapper, which will automatically
call exception callbacks when an exception is raised from the function. This
removes the need to specify the function and its arguments twice (once in the
function call itself and once in _call_exc_callbacks).
Add some extra checks to existing exception callbacks.
Diffstat (limited to 'ipalib/plugins/pwpolicy.py')
-rw-r--r-- | ipalib/plugins/pwpolicy.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ipalib/plugins/pwpolicy.py b/ipalib/plugins/pwpolicy.py index 2b586ec54..90a2ea110 100644 --- a/ipalib/plugins/pwpolicy.py +++ b/ipalib/plugins/pwpolicy.py @@ -414,11 +414,12 @@ class pwpolicy_mod(LDAPUpdate): return dn def exc_callback(self, keys, options, exc, call_func, *call_args, **call_kwargs): - if isinstance(exc, errors.EmptyModlist): - entry_attrs = call_args[1] - cosupdate = getattr(context, 'cosupdate') - if not entry_attrs or cosupdate: - return + if call_func.func_name == 'update_entry': + if isinstance(exc, errors.EmptyModlist): + entry_attrs = call_args[1] + cosupdate = getattr(context, 'cosupdate') + if not entry_attrs or cosupdate: + return raise exc api.register(pwpolicy_mod) |