Merge "[Part9] Remove six"

This commit is contained in:
Zuul 2021-11-01 09:43:44 +00:00 committed by Gerrit Code Review
commit a7593240cc
4 changed files with 12 additions and 16 deletions

View File

@ -16,7 +16,6 @@
import copy
import falcon
from oslo_log import log as logging
import six
from zaqar.common import decorators
from zaqar.i18n import _
@ -63,7 +62,7 @@ class ItemResource(object):
resp_dict[meta] = value
except storage_errors.DoesNotExist as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Topic metadata could not be retrieved.')
@ -88,7 +87,7 @@ class ItemResource(object):
self._validate.queue_metadata_putting(metadata)
except validation.ValidationFailed as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
try:
created = self._topic_controller.create(topic_name,
@ -97,7 +96,7 @@ class ItemResource(object):
except storage_errors.FlavorDoesNotExist as ex:
LOG.exception('Flavor "%s" does not exist', topic_name)
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Topic could not be created.')
LOG.exception(description)
@ -141,7 +140,7 @@ class ItemResource(object):
self._validate.queue_metadata_length(req.content_length)
except validation.ValidationFailed as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestBody(str(ex))
# NOTE(flwang): See below link to get more details about draft 10,
# tools.ietf.org/html/draft-ietf-appsawg-json-patch-10
@ -201,10 +200,10 @@ class ItemResource(object):
project_id)
except storage_errors.DoesNotExist as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
raise wsgi_errors.HTTPNotFound(str(ex))
except validation.ValidationFailed as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestBody(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestBody(str(ex))
except wsgi_errors.HTTPConflict:
raise
except Exception:
@ -261,7 +260,7 @@ class CollectionResource(object):
except validation.ValidationFailed as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
except Exception:
description = _(u'Topics could not be listed.')

View File

@ -15,7 +15,6 @@
import falcon
from oslo_log import log as logging
import six
from zaqar.common import decorators
from zaqar.i18n import _
@ -51,7 +50,7 @@ class Resource(object):
document = {'resource_types': ['messages', 'subscriptions']}
except validation.ValidationFailed as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
try:
if "messages" in document['resource_types']:

View File

@ -14,7 +14,6 @@
# limitations under the License.
from oslo_log import log as logging
import six
from zaqar.common import decorators
from zaqar.i18n import _
@ -70,7 +69,7 @@ class Resource(object):
except storage_errors.DoesNotExist as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPNotFound(six.text_type(ex))
raise wsgi_errors.HTTPNotFound(str(ex))
except Exception:
description = _(u'Topic stats could not be read.')

View File

@ -15,7 +15,6 @@
import os
from oslo_log import log as logging
import six
from zaqar.common import decorators
from zaqar.common import urls
@ -50,11 +49,11 @@ class Resource(object):
document = wsgi_utils.deserialize(req.stream, req.content_length)
except ValueError as ex:
LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
raise wsgi_errors.HTTPBadRequestAPI(str(ex))
diff = set(document.keys()) - _KNOWN_KEYS
if diff:
msg = six.text_type('Unknown keys: %s' % diff)
msg = str('Unknown keys: %s' % diff)
raise wsgi_errors.HTTPBadRequestAPI(msg)
key = self._conf.signed_url.secret_key
@ -64,7 +63,7 @@ class Resource(object):
else:
diff = set(paths) - _VALID_PATHS
if diff:
msg = six.text_type('Invalid paths: %s' % diff)
msg = str('Invalid paths: %s' % diff)
raise wsgi_errors.HTTPBadRequestAPI(msg)
paths = [os.path.join(req.path[:-6], path) for path in paths]