remove six
remove six in venus/exception.py remove six in requirements.txt Change-Id: If0401a01ccf2755a85fbc03ca31adb8a19962972
This commit is contained in:
parent
37ec3e215c
commit
39c5e1cecb
@ -22,7 +22,6 @@ oslo.versionedobjects>=0.9.0
|
||||
oslo.i18n>=1.5.0 # Apache-2.0
|
||||
osprofiler>=0.3.0 # Apache-2.0
|
||||
openstacksdk>=0.46.0 # Apache-2.0
|
||||
six>=1.9.0
|
||||
SQLAlchemy>=1.2.19 # MIT
|
||||
sqlalchemy-migrate>=0.9.6
|
||||
PyMySQL>=0.7.11
|
||||
|
@ -20,10 +20,8 @@ SHOULD include dedicated exception logging.
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
from oslo_versionedobjects import exception as obj_exc
|
||||
import six
|
||||
import webob.exc
|
||||
|
||||
from venus.common.utils import LOG
|
||||
@ -68,14 +66,13 @@ class VenusException(Exception):
|
||||
|
||||
for k, v in self.kwargs.items():
|
||||
if isinstance(v, Exception):
|
||||
self.kwargs[k] = six.text_type(v)
|
||||
self.kwargs[k] = str(v)
|
||||
|
||||
if self._should_format():
|
||||
try:
|
||||
message = self.message % kwargs
|
||||
|
||||
except Exception:
|
||||
exc_info = sys.exc_info()
|
||||
except Exception as e:
|
||||
# kwargs doesn't match a variable in the message
|
||||
# log the issue and the kwargs
|
||||
LOG.exception(_LE('Exception in string format operation'))
|
||||
@ -83,11 +80,11 @@ class VenusException(Exception):
|
||||
LOG.error(_LE("%(name)s: %(value)s"),
|
||||
{'name': name, 'value': value})
|
||||
if CONF.fatal_exception_format_errors:
|
||||
six.reraise(*exc_info)
|
||||
raise e
|
||||
# at least get the core message out if something happened
|
||||
message = self.message
|
||||
elif isinstance(message, Exception):
|
||||
message = six.text_type(message)
|
||||
message = str(message)
|
||||
|
||||
# NOTE(luisg): We put the actual message in 'msg' so that we can access
|
||||
# it, because if we try to access the message via 'message' it will be
|
||||
@ -99,7 +96,7 @@ class VenusException(Exception):
|
||||
return self.kwargs['message'] is None or '%(message)' in self.message
|
||||
|
||||
def __unicode__(self):
|
||||
return six.text_type(self.msg)
|
||||
return str(self.msg)
|
||||
|
||||
|
||||
class NotAuthorized(VenusException):
|
||||
|
Loading…
Reference in New Issue
Block a user