Merge "py3: Replace basestring with six.string_types"
This commit is contained in:
commit
fdc8828e85
@ -133,7 +133,9 @@ def check_metadata(req, target_type):
|
||||
meta_count = 0
|
||||
meta_size = 0
|
||||
for key, value in req.headers.items():
|
||||
if isinstance(value, basestring) and len(value) > MAX_HEADER_SIZE:
|
||||
if (isinstance(value, six.string_types)
|
||||
and len(value) > MAX_HEADER_SIZE):
|
||||
|
||||
return HTTPBadRequest(body='Header value too long: %s' %
|
||||
key[:MAX_META_NAME_LENGTH],
|
||||
request=req, content_type='text/plain')
|
||||
|
@ -23,6 +23,7 @@ import socket
|
||||
from time import time
|
||||
|
||||
from eventlet import sleep, Timeout
|
||||
import six
|
||||
from six.moves.http_client import HTTPException
|
||||
|
||||
from swift.common.bufferedhttp import http_connect
|
||||
@ -399,7 +400,7 @@ def direct_put_object(node, part, account, container, name, contents,
|
||||
headers['Content-Type'] = 'application/octet-stream'
|
||||
if not contents:
|
||||
headers['Content-Length'] = '0'
|
||||
if isinstance(contents, basestring):
|
||||
if isinstance(contents, six.string_types):
|
||||
contents = [contents]
|
||||
# Incase the caller want to insert an object with specific age
|
||||
add_ts = 'X-Timestamp' not in headers
|
||||
|
@ -23,6 +23,7 @@ import hmac
|
||||
import base64
|
||||
|
||||
from eventlet import Timeout
|
||||
import six
|
||||
from six.moves.urllib.parse import unquote
|
||||
from swift.common.swob import Response, Request
|
||||
from swift.common.swob import HTTPBadRequest, HTTPForbidden, HTTPNotFound, \
|
||||
@ -460,7 +461,7 @@ class TempAuth(object):
|
||||
if not isinstance(result[key], list):
|
||||
return "Value for key '%s' must be a list" % key
|
||||
for grantee in result[key]:
|
||||
if not isinstance(grantee, basestring):
|
||||
if not isinstance(grantee, six.string_types):
|
||||
return "Elements of '%s' list must be strings" % key
|
||||
|
||||
# Everything looks fine, no errors found
|
||||
|
@ -30,7 +30,7 @@ from swift.common.ring import RingBuilder
|
||||
class RunSwiftRingBuilderMixin(object):
|
||||
|
||||
def run_srb(self, *argv):
|
||||
if len(argv) == 1 and isinstance(argv[0], basestring):
|
||||
if len(argv) == 1 and isinstance(argv[0], six.string_types):
|
||||
# convert a single string to a list
|
||||
argv = shlex.split(argv[0])
|
||||
mock_stdout = six.StringIO()
|
||||
|
Loading…
x
Reference in New Issue
Block a user