diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-24 15:04:53 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-24 15:04:53 -0400 |
commit | 7a3e091c1c9cc9ae6e34279c7c99c9989afd8894 (patch) | |
tree | 97ede8905e5379ada56f1ce40842066c5bb7ec31 /oslo | |
parent | 3fdafcd17f85e532342d5ddb45b972b5c462f843 (diff) | |
download | oslo-db-7a3e091c1c9cc9ae6e34279c7c99c9989afd8894.tar.gz |
Unwrap DialectFunctionDispatcher from itself.
The DialectFunctionDispatcher.dispatch_for() decorator method
necessarily returns the dispatcher itself and not the
decorated function, so that the object can continue to be
re-used even if the function name is the same as that of the
dispatcher. In order to support a single function being
wrapped by the dispatcher multiple times with different
criteria, dispatch_for() will now check for the last function
wrapped and use that.
Change-Id: I331670d9b76ae30e7a666648e7e2d4c72641c9ff
Closes-Bug: #1373568
Diffstat (limited to 'oslo')
-rw-r--r-- | oslo/db/sqlalchemy/utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/oslo/db/sqlalchemy/utils.py b/oslo/db/sqlalchemy/utils.py index adc9bef..71cd1ea 100644 --- a/oslo/db/sqlalchemy/utils.py +++ b/oslo/db/sqlalchemy/utils.py @@ -899,6 +899,9 @@ class DialectFunctionDispatcher(object): def dispatch_for(self, expr): def decorate(fn): dbname, driver = self._parse_dispatch(expr) + if fn is self: + fn = fn._last + self._last = fn self._register(expr, dbname, driver, fn) return self return decorate |