diff --git a/swift/common/middleware/slo.py b/swift/common/middleware/slo.py index 35b98c988b..47e9a660ff 100644 --- a/swift/common/middleware/slo.py +++ b/swift/common/middleware/slo.py @@ -297,11 +297,11 @@ def parse_and_validate_input(req_body, req_path): for ek in sorted(extraneous_keys)))) continue - if not isinstance(seg_dict['path'], basestring): + if not isinstance(seg_dict['path'], six.string_types): errors.append("Index %d: \"path\" must be a string" % seg_index) continue if not (seg_dict['etag'] is None or - isinstance(seg_dict['etag'], basestring)): + isinstance(seg_dict['etag'], six.string_types)): errors.append( "Index %d: \"etag\" must be a string or null" % seg_index) continue diff --git a/swift/common/swob.py b/swift/common/swob.py index 2ba5d5e6a4..717eb8bca8 100644 --- a/swift/common/swob.py +++ b/swift/common/swob.py @@ -284,7 +284,7 @@ def _resp_status_property(): return '%s %s' % (self.status_int, self.title) def setter(self, value): - if isinstance(value, (int, long)): + if isinstance(value, six.integer_types): self.status_int = value self.explanation = self.title = RESPONSE_REASONS[value][0] else: diff --git a/swift/common/utils.py b/swift/common/utils.py index d3ef5a7dcb..e8715ff62b 100644 --- a/swift/common/utils.py +++ b/swift/common/utils.py @@ -964,7 +964,7 @@ def decode_timestamps(encoded, explicit=False): # TODO: some tests, e.g. in test_replicator, put float timestamps values # into container db's, hence this defensive check, but in real world # this may never happen. - if not isinstance(encoded, basestring): + if not isinstance(encoded, six.string_types): ts = Timestamp(encoded) return ts, ts, ts diff --git a/test/unit/cli/test_ring_builder_analyzer.py b/test/unit/cli/test_ring_builder_analyzer.py index 2de2b16a9c..980a016c51 100644 --- a/test/unit/cli/test_ring_builder_analyzer.py +++ b/test/unit/cli/test_ring_builder_analyzer.py @@ -17,8 +17,8 @@ import os import json import mock +from six import StringIO import unittest -from StringIO import StringIO from test.unit import with_tempdir from swift.cli.ring_builder_analyzer import parse_scenario, run_scenario