Merge "String-related fixes for Python 3"
This commit is contained in:
commit
19438a26e9
|
@ -100,7 +100,8 @@ class HashRing(Coordinator):
|
|||
|
||||
@staticmethod
|
||||
def _hash(key):
|
||||
return int(hashlib.md5(str(key)).hexdigest(), 16) # nosec
|
||||
return int(
|
||||
hashlib.md5(str(key).encode('utf-8')).hexdigest(), 16) # nosec
|
||||
|
||||
def _build_ring(self):
|
||||
ring = {}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
import sahara.exceptions as e
|
||||
from sahara.i18n import _
|
||||
|
@ -31,7 +32,7 @@ def check_job_binary_internal(data, **kwargs):
|
|||
if not is_internal_db_enabled():
|
||||
raise e.BadJobBinaryInternalException(
|
||||
_("Sahara internal db is disabled for storing job binaries."))
|
||||
if not (type(data) is str and len(data) > 0):
|
||||
if not (isinstance(data, six.string_types) and len(data) > 0):
|
||||
raise e.BadJobBinaryInternalException()
|
||||
if "name" in kwargs:
|
||||
name = kwargs["name"]
|
||||
|
|
|
@ -18,6 +18,7 @@ import traceback
|
|||
import flask
|
||||
from oslo_log import log as logging
|
||||
from oslo_middleware import request_id as oslo_req_id
|
||||
import six
|
||||
from werkzeug import datastructures
|
||||
|
||||
from sahara import context
|
||||
|
@ -53,7 +54,7 @@ class Rest(flask.Blueprint):
|
|||
return self._mroute('PATCH', rule, status_code)
|
||||
|
||||
def _mroute(self, methods, rule, status_code=None, **kw):
|
||||
if type(methods) is str:
|
||||
if isinstance(methods, six.string_types):
|
||||
methods = [methods]
|
||||
return self.route(rule, methods=methods, status_code=status_code, **kw)
|
||||
|
||||
|
|
Loading…
Reference in New Issue