diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-04-25 10:31:10 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-06-14 11:09:43 +0200 |
commit | 9960149e3f84564ab324bfb9db7c50063d87a7bd (patch) | |
tree | c3caa731e88c1c12479edd6a2e59a9518688626b /make-lint | |
parent | f52fa2a0185c8cc4e1c2cacda3eac59209e659f4 (diff) | |
download | freeipa-9960149e3f84564ab324bfb9db7c50063d87a7bd.tar.gz freeipa-9960149e3f84564ab324bfb9db7c50063d87a7bd.tar.xz freeipa-9960149e3f84564ab324bfb9db7c50063d87a7bd.zip |
Rework the CallbackInterface
Fix several problems with the callback interface:
- Automatically registered callbacks (i.e. methods named
exc_callback, pre_callback etc) were registered on every
instantiation.
Fix: Do not register callbacks in __init__; instead return the
method when asked for it.
- The calling code had to distinguish between bound methods and
plain functions by checking the 'im_self' attribute.
Fix: Always return the "default" callback as an unbound method.
Registered callbacks now always take the extra `self` argument,
whether they happen to be bound methods or not.
Calling code now always needs to pass the `self` argument.
- Did not work well with inheritance: due to the fact that Python
looks up missing attributes in superclasses, callbacks could
get attached to a superclass if it was instantiated early enough. *
Fix: Instead of attribute lookup, use a dictionary with class keys.
- The interface included the callback types, which are LDAP-specific.
Fix: Create generic register_callback and get_callback mehods,
move LDAP-specific code to BaseLDAPCommand
Update code that calls the callbacks.
Add tests.
Remove lint exceptions for CallbackInterface.
* https://fedorahosted.org/freeipa/ticket/2674
Diffstat (limited to 'make-lint')
-rwxr-xr-x | make-lint | 2 |
1 files changed, 0 insertions, 2 deletions
@@ -51,8 +51,6 @@ class IPATypeChecker(TypeChecker): 'ipalib.plugable.Plugin': ['Command', 'Object', 'Method', 'Property', 'Backend', 'env', 'debug', 'info', 'warning', 'error', 'critical', 'exception', 'context', 'log'], - 'ipalib.plugins.baseldap.CallbackInterface': ['pre_callback', - 'post_callback', 'exc_callback'], 'ipalib.plugins.misc.env': ['env'], 'ipalib.parameters.Param': ['cli_name', 'cli_short_name', 'label', 'doc', 'required', 'multivalue', 'primary_key', 'normalizer', |