summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2014-04-17 15:30:12 +0200
committerJan Safranek <jsafrane@redhat.com>2014-04-17 15:30:12 +0200
commit80ff95749c86d09260d19c5d8f52564ed78f1a2c (patch)
tree3bed2d4beb9d882ec17b0aec7351043f3da1b003 /src
parent9621f87dddc14333ce691656127fa317cae42936 (diff)
downloadopenlmi-providers-80ff95749c86d09260d19c5d8f52564ed78f1a2c.tar.gz
openlmi-providers-80ff95749c86d09260d19c5d8f52564ed78f1a2c.tar.xz
openlmi-providers-80ff95749c86d09260d19c5d8f52564ed78f1a2c.zip
Update job_request decorator for Python 2.6
There is no inspect.callargs there, so we must assume that 'async' is in kwargs.
Diffstat (limited to 'src')
-rw-r--r--src/software/lmi/software/yumdb/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/software/lmi/software/yumdb/__init__.py b/src/software/lmi/software/yumdb/__init__.py
index 705ec9c..4c5364e 100644
--- a/src/software/lmi/software/yumdb/__init__.py
+++ b/src/software/lmi/software/yumdb/__init__.py
@@ -71,6 +71,9 @@ def job_request(async=False):
Job objects are processed by this decorator for caller to obtain only the
information he needs.
+ If async == True, the wrapped method must have 'async' argument in
+ its **kwargs.
+
It wrapps them with logger wrapper and in case of asynchronous jobs,
it returns just the jobid.
"""
@@ -94,9 +97,8 @@ def job_request(async=False):
@wraps(method)
def _new_func(self, *args, **kwargs):
"""Wrapper for YumDB's method."""
- callargs = inspect.getcallargs(method, self, *args, **kwargs)
result = logged(self, *args, **kwargs)
- if callargs.get('async', False):
+ if kwargs.get('async', False):
return result
else:
return result.result_data