diff options
author | Michal Minar <miminar@redhat.com> | 2013-10-14 09:20:08 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-10-18 11:27:27 +0200 |
commit | 1c81ff825046681ae0d9f7a27da33e7abed8bf96 (patch) | |
tree | 85e62a39e6838524bda521704c8ecdeeb0bec13b | |
parent | 99148a1ed6efa3796c4b03aba569eaf707fe4d50 (diff) | |
download | openlmi-providers-1c81ff825046681ae0d9f7a27da33e7abed8bf96.tar.gz openlmi-providers-1c81ff825046681ae0d9f7a27da33e7abed8bf96.tar.xz openlmi-providers-1c81ff825046681ae0d9f7a27da33e7abed8bf96.zip |
python: correctly create function wrappers
Function wrappers should look like the functions being wrapped. Without
the *wraps()* decorator, the resulting function would not have assigned
doc string, would have wrong name etc.
-rw-r--r-- | src/python/lmi/providers/cmpi_logging.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/python/lmi/providers/cmpi_logging.py b/src/python/lmi/providers/cmpi_logging.py index dca9ac8..06c496e 100644 --- a/src/python/lmi/providers/cmpi_logging.py +++ b/src/python/lmi/providers/cmpi_logging.py @@ -23,6 +23,7 @@ under cimom. """ import logging +import functools import inspect from itertools import chain import os @@ -230,6 +231,7 @@ def _trace_function_or_method(is_method=False, frame_level=1): classname = inspect.getouterframes( inspect.currentframe())[frame_level][3] + @functools.wraps(func) def _wrapper(*args, **kwargs): """ Wrapper for function or method, that does the logging. |