diff options
author | Jan Safranek <jsafrane@redhat.com> | 2014-04-17 15:30:12 +0200 |
---|---|---|
committer | Jan Safranek <jsafrane@redhat.com> | 2014-04-17 15:30:12 +0200 |
commit | 80ff95749c86d09260d19c5d8f52564ed78f1a2c (patch) | |
tree | 3bed2d4beb9d882ec17b0aec7351043f3da1b003 /src | |
parent | 9621f87dddc14333ce691656127fa317cae42936 (diff) | |
download | openlmi-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__.py | 6 |
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 |