summaryrefslogtreecommitdiff
path: root/oslo_db/sqlalchemy/enginefacade.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-06-12 13:26:39 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-07-02 18:02:24 -0400
commitdf6bf3401266f42271627c1e408f87c71a06cef7 (patch)
treefd0fb9c69dee834125ba98ebf21831c84bf25bc8 /oslo_db/sqlalchemy/enginefacade.py
parent4c70002578d8ea109a7d0889ab53b9c20bae6ed4 (diff)
downloadoslo-db-df6bf3401266f42271627c1e408f87c71a06cef7.tar.gz
Rename enginefacade.async to enginefacade.async_
Python 3.7 now makes "async" a keyword, so deprecate the "async" name and replace with "async_". Additionally, use attribute name access only in order to implement and test "async" as it won't work under Python 3.7. Closes-Bug: #1775866 Change-Id: Ifb2c59c2cfbd615b04570b31fcfe868f4ffea3c6
Diffstat (limited to 'oslo_db/sqlalchemy/enginefacade.py')
-rw-r--r--oslo_db/sqlalchemy/enginefacade.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/oslo_db/sqlalchemy/enginefacade.py b/oslo_db/sqlalchemy/enginefacade.py
index 2b9f81e..481e166 100644
--- a/oslo_db/sqlalchemy/enginefacade.py
+++ b/oslo_db/sqlalchemy/enginefacade.py
@@ -17,6 +17,7 @@ import operator
import threading
import warnings
+import debtcollector.moves
import debtcollector.removals
import debtcollector.renames
from oslo_config import cfg
@@ -965,7 +966,7 @@ class _TransactionContextManager(object):
return self._clone(connection=True)
@property
- def async(self):
+ def async_(self):
"""Modifier to set a READER operation to ASYNC_READER."""
if self._mode is _WRITER:
@@ -1049,6 +1050,17 @@ class _TransactionContextManager(object):
transaction_contexts_by_thread.current = restore
+@property
+@debtcollector.moves.moved_property("async_")
+def async_compat(self):
+ return self.async_
+
+setattr(
+ _TransactionContextManager,
+ "async", async_compat
+)
+
+
def _context_descriptor(attr=None):
getter = operator.attrgetter(attr)