diff options
author | asteroide <thomas.duval@orange.com> | 2015-09-24 16:27:16 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2015-09-24 16:27:16 +0200 |
commit | 92d11d139e9f76d4fd76859aea78643fc32ef36b (patch) | |
tree | bd5a2e7b50853498074ab55bdaee4452c460010b /keystone-moon/keystone/notifications.py | |
parent | 49325d99acfadaadfad99c596c4ada6b5ec849de (diff) |
Update Keystone code from repository.
Change-Id: Ib3d0a06b10902fcc6d520f58e85aa617bc326d00
Diffstat (limited to 'keystone-moon/keystone/notifications.py')
-rw-r--r-- | keystone-moon/keystone/notifications.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/keystone-moon/keystone/notifications.py b/keystone-moon/keystone/notifications.py index 801dd737..bea09d3c 100644 --- a/keystone-moon/keystone/notifications.py +++ b/keystone-moon/keystone/notifications.py @@ -242,19 +242,20 @@ def internal(*args, **kwargs): def _get_callback_info(callback): """Return list containing callback's module and name. - If the callback is an instance method also return the class name. + If the callback is a bound instance method also return the class name. :param callback: Function to call :type callback: function :returns: List containing parent module, (optional class,) function name :rtype: list """ - if getattr(callback, 'im_class', None): - return [getattr(callback, '__module__', None), - callback.im_class.__name__, - callback.__name__] + module_name = getattr(callback, '__module__', None) + func_name = callback.__name__ + if inspect.ismethod(callback): + class_name = callback.__self__.__class__.__name__ + return [module_name, class_name, func_name] else: - return [getattr(callback, '__module__', None), callback.__name__] + return [module_name, func_name] def register_event_callback(event, resource_type, callbacks): |