diff options
author | abhishekkekane <abhishek.kekane@nttdata.com> | 2016-01-31 01:34:37 -0800 |
---|---|---|
committer | Abhishek Kekane <abhishek.kekane@nttdata.com> | 2016-04-19 07:02:39 +0000 |
commit | a56301c237290588b9b62175c67c38e789ea8ede (patch) | |
tree | f5b9bbf900e9f01570d97c9156254dd83c15e29a /trove/configuration | |
parent | 9f877e5ba74ca436d78552add1631b8598946854 (diff) | |
download | trove-a56301c237290588b9b62175c67c38e789ea8ede.tar.gz |
Python3: Add support for unicode, basestring, long
Replaced basestring with six.string_types
Replaced (int, long) with six.integer_types
Replaced unicode with six.text_type
This patch is generated by the following tool using
'basestring', 'long' and 'unicode' options.
Manually replaced unicode(ex) with oslo_utils.encodeutils(ex)
https://github.com/haypo/sixer
Command:
python sixer.py -w 'basestring,long,unicode' trove/
Partially implements: blueprint trove-python3
Change-Id: I6fa42674060067663ef819247ea793ef3d8aa0da
Diffstat (limited to 'trove/configuration')
-rw-r--r-- | trove/configuration/service.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/trove/configuration/service.py b/trove/configuration/service.py index b26086ca..fc68146d 100644 --- a/trove/configuration/service.py +++ b/trove/configuration/service.py @@ -16,6 +16,7 @@ from datetime import datetime from oslo_log import log as logging +import six import trove.common.apischema as apischema from trove.common import cfg @@ -269,7 +270,7 @@ class ConfigurationsController(wsgi.Controller): raise exception.UnprocessableEntity(message=msg) # integer min/max checking - if isinstance(v, (int, long)) and not isinstance(v, bool): + if isinstance(v, six.integer_types) and not isinstance(v, bool): if rule.min_size is not None: try: min_value = int(rule.min_size) @@ -307,9 +308,9 @@ class ConfigurationsController(wsgi.Controller): if value_type == "boolean": return bool elif value_type == "string": - return basestring + return six.string_types elif value_type == "integer": - return (int, long) + return six.integer_types else: raise exception.TroveError(_( "Invalid or unsupported type defined in the " |