diff options
author | Chuck Short <chuck.short@canonical.com> | 2013-05-01 11:22:23 -0500 |
---|---|---|
committer | Chuck Short <chuck.short@canonical.com> | 2013-05-06 15:52:26 -0500 |
commit | fde1e156a38633ce9018569145390bce2047fea8 (patch) | |
tree | ff31b1d70f5e6e35cff4a40101db0ea90ed58bcb /openstack/common/db/sqlalchemy | |
parent | 0c9047cc334578f9f4974c3bc006ba9bc62814d2 (diff) | |
download | oslo-fde1e156a38633ce9018569145390bce2047fea8.tar.gz oslo-fde1e156a38633ce9018569145390bce2047fea8.tar.xz oslo-fde1e156a38633ce9018569145390bce2047fea8.zip |
Convert unicode for python3 portability
From http://docs.python.org/3.1/whatsnew/3.0.html:
"Python 3.0 uses the concepts of text and (binary) data instead of
Unicode strings and 8-bit strings."
Use six.text_type to Type for representing (Unicode) textual data. This
is unicode() in Python 2 and str in Python 3.
Change-Id: I3da268a714a34a8e626a2590f01b86e414dc3411
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Diffstat (limited to 'openstack/common/db/sqlalchemy')
-rw-r--r-- | openstack/common/db/sqlalchemy/session.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/openstack/common/db/sqlalchemy/session.py b/openstack/common/db/sqlalchemy/session.py index a19fc01..d2a54ee 100644 --- a/openstack/common/db/sqlalchemy/session.py +++ b/openstack/common/db/sqlalchemy/session.py @@ -246,6 +246,7 @@ import time from eventlet import greenthread from oslo.config import cfg +import six from sqlalchemy import exc as sqla_exc import sqlalchemy.interfaces from sqlalchemy.interfaces import PoolListener @@ -483,7 +484,7 @@ def _add_regexp_listener(dbapi_con, con_record): def regexp(expr, item): reg = re.compile(expr) - return reg.search(unicode(item)) is not None + return reg.search(six.text_type(item)) is not None dbapi_con.create_function('regexp', 2, regexp) |