Fix assorted typos

Change-Id: I54c018c7044224f0365f4f378cf75013e0746731
This commit is contained in:
Tim Burke 2016-07-08 10:23:23 -07:00
parent 57bb9cca05
commit 2d4e1832c8
19 changed files with 42 additions and 42 deletions

View File

@ -116,7 +116,7 @@ class BaseAclHandler(object):
"""
General acl handling method.
This method expects to call Request._get_response() in outside of
this method so that this method returns resonse only when sw_method
this method so that this method returns response only when sw_method
is HEAD.
"""
@ -278,7 +278,7 @@ class MultiUploadAclHandler(BaseAclHandler):
"""
MultiUpload stuff requires acl checking just once for BASE container
so that MultiUploadAclHandler extends BaseAclHandler to check acl only
when the verb defined. We should define tThe verb as the first step to
when the verb defined. We should define the verb as the first step to
request to backend Swift at incoming request.
Basic Rules:

View File

@ -189,7 +189,7 @@ class BucketController(Controller):
raise exc_type, exc_value, exc_traceback
if location != CONF.location:
# Swift3 cannot support multiple reagions now.
# Swift3 cannot support multiple regions currently.
raise InvalidLocationConstraint()
resp = req.get_response(self.app)

View File

@ -255,7 +255,7 @@ class UploadsController(Controller):
return obj_dict
# uploads is a list consists of dict, {key, upload_id, last_modified}
# Note that pattern matcher willd drop whole segments objects like as
# Note that pattern matcher will drop whole segments objects like as
# object_name/upload_id/1.
pattern = re.compile('/[0-9]+$')
uploads = [object_to_upload(obj) for obj in objects if

View File

@ -32,7 +32,7 @@ class ObjectController(Controller):
def _gen_head_range_resp(self, req_range, resp):
"""
Swift doesn't handle Range header for HEAD requests.
So, this mothod generates HEAD range response from HEAD response.
So, this method generates HEAD range response from HEAD response.
S3 return HEAD range response, if the value of range satisfies the
conditions which are described in the following document.
- http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35

View File

@ -38,7 +38,7 @@ class ServiceController(Controller):
containers = filter(
lambda item: validate_bucket_name(item['name']), containers)
# we don't keep the creation time of a backet (s3cmd doesn't
# we don't keep the creation time of a bucket (s3cmd doesn't
# work without that) so we use something bogus.
elem = Element('ListAllMyBucketsResult')

View File

@ -67,7 +67,7 @@ from swift.common.utils import get_logger, register_swift_info
class Swift3Middleware(object):
"""Swift3 S3 compatibility midleware"""
"""Swift3 S3 compatibility middleware"""
def __init__(self, app, conf, *args, **kwargs):
self.app = app
self.slo_enabled = conf['allow_multipart_uploads']
@ -132,7 +132,7 @@ class Swift3Middleware(object):
self.slo_enabled = False
LOGGER.warning('swift3 middleware requires SLO middleware '
'to support multi-part upload, please add it '
'in pipline')
'in pipeline')
if not conf.auth_pipeline_check:
LOGGER.debug('Skip pipeline auth check.')

View File

@ -396,7 +396,7 @@ class Request(swob.Request):
if not self._timestamp:
try:
if self._is_query_auth and 'Timestamp' in self.params:
# If Timestamp speciied in query, it should be prior
# If Timestamp specified in query, it should be prior
# to any Date header (is this right?)
timestamp = mktime(
self.params['Timestamp'], SIGV2_TIMESTAMP_FORMAT)
@ -1215,7 +1215,7 @@ class S3AclRequest(Request):
self, container, obj, headers)
resp = acl_handler.handle_acl(app, method)
# possible to skip recalling get_resposne_acl if resp is not
# possible to skip recalling get_response_acl if resp is not
# None (e.g. HEAD)
if resp:
return resp

View File

@ -186,7 +186,7 @@ class Grantee(object):
elif type == 'emailAddress':
raise S3NotImplemented()
elif type == 'uri':
# retrun a subclass instance of Group class
# return a subclass instance of Group class
subclass = get_group_subclass_from_uri(value)
return subclass()
else:

View File

@ -97,7 +97,7 @@ class Connection(object):
:param body: a string of data binary sent to S3 as a request body
:param query: a string of HTTP query argument
:returns: a tuple of (int(status_code), headers dict, resposne body)
:returns: a tuple of (int(status_code), headers dict, response body)
"""
response = \
self.conn.make_request(method, bucket=bucket, key=obj,

View File

@ -51,7 +51,7 @@ class TestSwift3Bucket(Swift3FunctionalTestCase):
self.assertTrue(headers['content-type'] is not None)
self.assertEqual(headers['content-length'], str(len(body)))
# TODO; requires consideration
# self.assertEquasl(headers['transfer-encoding'], 'chunked')
# self.assertEqual(headers['transfer-encoding'], 'chunked')
elem = fromstring(body, 'ListBucketResult')
self.assertEqual(elem.find('Name').text, bucket)
@ -100,7 +100,7 @@ class TestSwift3Bucket(Swift3FunctionalTestCase):
self.assertTrue(headers['content-type'] is not None)
self.assertEqual(headers['content-length'], str(len(body)))
# TODO; requires consideration
# self.assertEquasl(headers['transfer-encoding'], 'chunked')
# self.assertEqual(headers['transfer-encoding'], 'chunked')
# DELETE Bucket
for obj in req_objects:
@ -289,17 +289,17 @@ class TestSwift3Bucket(Swift3FunctionalTestCase):
status, headers, body = \
self.conn.make_request('HEAD', 'bucket+invalid')
self.assertEqual(status, 400)
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
auth_error_conn = Connection(aws_secret_key='invalid')
status, headers, body = \
auth_error_conn.make_request('HEAD', 'bucket')
self.assertEqual(status, 403)
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
status, headers, body = self.conn.make_request('HEAD', 'nothing')
self.assertEqual(status, 404)
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
def test_delete_bucket_error(self):
status, headers, body = \

View File

@ -202,7 +202,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase):
elem = fromstring(body, 'ListPartsResult')
# FIXME: COPY result drops mili/microseconds but GET doesn't
# FIXME: COPY result drops milli/microseconds but GET doesn't
last_modified_gets = [p.find('LastModified').text
for p in elem.iterfind('Part')]
self.assertEqual(
@ -248,7 +248,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase):
self.assertTrue(last_modified is not None)
# TODO: sanity check
# (kota_) How do we check the sanity?
# the last-modified header drops mili-seconds info
# the last-modified header drops milli-seconds info
# by the constraint of the format.
# For now, we can do either the format check or round check
# last_modified_from_xml = mktime(last_modified)
@ -501,7 +501,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase):
query=query)
self.assertEqual(get_error_code(body), 'MalformedXML')
# with ivalid etag in xml
# with invalid etag in xml
invalid_etag = 'invalid'
xml = self._gen_comp_xml([invalid_etag])
status, headers, body = \
@ -613,7 +613,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase):
elem = fromstring(body, 'ListPartsResult')
# FIXME: COPY result drops mili/microseconds but GET doesn't
# FIXME: COPY result drops milli/microseconds but GET doesn't
last_modified_gets = [p.find('LastModified').text
for p in elem.iterfind('Part')]
self.assertEqual(
@ -630,7 +630,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase):
status, headers, body = \
self.conn.make_request('DELETE', bucket, key, query=query)
# sanities
# sanity checks
self.assertEqual(status, 204)
self.assertCommonResponseHeaders(headers)
self.assertTrue('content-type' in headers)

View File

@ -100,7 +100,7 @@ class TestSwift3Object(Swift3FunctionalTestCase):
self.assertEqual(status, 200)
elem = fromstring(body, 'ListBucketResult')
# FIXME: COPY result drops mili/microseconds but GET doesn't
# FIXME: COPY result drops milli/microseconds but GET doesn't
self.assertEqual(
elem.find('Contents').find("LastModified").text.rsplit('.', 1)[0],
last_modified_xml.rsplit('.', 1)[0])
@ -207,19 +207,19 @@ class TestSwift3Object(Swift3FunctionalTestCase):
status, headers, body = \
auth_error_conn.make_request('HEAD', self.bucket, obj)
self.assertEqual(status, 403)
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
self.assertEqual(headers['content-type'], 'application/xml')
status, headers, body = \
self.conn.make_request('HEAD', self.bucket, 'invalid')
self.assertEqual(status, 404)
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
self.assertEqual(headers['content-type'], 'application/xml')
status, headers, body = \
self.conn.make_request('HEAD', 'invalid', obj)
self.assertEqual(status, 404)
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
self.assertEqual(headers['content-type'], 'application/xml')
def test_delete_object_error(self):

View File

@ -34,7 +34,7 @@ class TestSwift3Service(Swift3FunctionalTestCase):
self.assertCommonResponseHeaders(headers)
self.assertTrue(headers['content-type'] is not None)
# TODO; requires consideration
# self.assertEquasl(headers['transfer-encoding'], 'chunked')
# self.assertEqual(headers['transfer-encoding'], 'chunked')
elem = fromstring(body, 'ListAllMyBucketsResult')
buckets = elem.findall('./Buckets/Bucket')

View File

@ -91,7 +91,7 @@ class TestSwift3Bucket(Swift3TestCase):
'Date': self.get_date_header()})
status, headers, body = self.call_swift3(req)
self.assertEqual(status.split()[0], '404')
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
def test_bucket_HEAD_slash(self):
req = Request.blank('/junk/',
@ -470,7 +470,7 @@ class TestSwift3Bucket(Swift3TestCase):
@s3acl
def test_bucket_DELETE_error_while_segment_bucket_delete(self):
# An error occured while deleting segment objects
# An error occurred while deleting segment objects
self.swift.register('DELETE', '/v1/AUTH_test/bucket+segments/lily',
swob.HTTPServiceUnavailable, {}, json.dumps([]))
# overwrite default HEAD to return x-container-object-count
@ -486,7 +486,7 @@ class TestSwift3Bucket(Swift3TestCase):
self.assertEqual(status.split()[0], '503')
called = [(method, path) for method, path, _ in
self.swift.calls_with_headers]
# Don't delete original bucket when error occured in segment container
# Don't delete original bucket when error occurred in segment container
self.assertNotIn(('DELETE', '/v1/AUTH_test/bucket'), called)
def _test_bucket_for_s3acl(self, method, account):

View File

@ -810,7 +810,7 @@ class TestSwift3Middleware(Swift3TestCase):
req.content_type = 'text/plain'
status, headers, body = self.call_swift3(req)
# FIXME: should this failed as 400 or pass via query auth?
# for now, 403 forbbiden for safety
# for now, 403 forbidden for safety
self.assertEqual(status.split()[0], '403', body)
# But if we are missing Signature in query param

View File

@ -130,32 +130,32 @@ class TestSwift3Obj(Swift3TestCase):
swob.HTTPUnauthorized, {}, None)
status, headers, body = self.call_swift3(req)
self.assertEqual(status.split()[0], '403')
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
self.swift.register('HEAD', '/v1/AUTH_test/bucket/object',
swob.HTTPForbidden, {}, None)
status, headers, body = self.call_swift3(req)
self.assertEqual(status.split()[0], '403')
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
self.swift.register('HEAD', '/v1/AUTH_test/bucket/object',
swob.HTTPNotFound, {}, None)
status, headers, body = self.call_swift3(req)
self.assertEqual(status.split()[0], '404')
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
self.swift.register('HEAD', '/v1/AUTH_test/bucket/object',
swob.HTTPPreconditionFailed, {}, None)
status, headers, body = self.call_swift3(req)
self.assertEqual(status.split()[0], '412')
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
self.swift.register('HEAD', '/v1/AUTH_test/bucket/object',
swob.HTTPServerError, {}, None)
status, headers, body = self.call_swift3(req)
self.assertEqual(status.split()[0], '500')
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
self.swift.register('HEAD', '/v1/AUTH_test/bucket/object',
swob.HTTPServiceUnavailable, {}, None)
status, headers, body = self.call_swift3(req)
self.assertEqual(status.split()[0], '500')
self.assertEqual(body, '') # sanifty
self.assertEqual(body, '') # sanity
def test_object_HEAD(self):
self._test_object_GETorHEAD('HEAD')

View File

@ -48,7 +48,7 @@ def s3acl(func=None, s3acl_only=False):
def call_func(failing_point=''):
try:
# For maintainancibility, we patch 204 status for every
# For maintainability, we patch 204 status for every
# get_container_info. if you want, we can rewrite the
# statement easily with nested decorator like as:
#

View File

@ -87,13 +87,13 @@ class TestSwift3Utils(unittest.TestCase):
# integer
ts = utils.S3Timestamp(1)
self.assertEqual(expected, ts.s3xmlformat)
# miliseconds unit should be floored
# milliseconds unit should be floored
ts = utils.S3Timestamp(1.1)
self.assertEqual(expected, ts.s3xmlformat)
# float (microseconds) should be floored too
ts = utils.S3Timestamp(1.000001)
self.assertEqual(expected, ts.s3xmlformat)
# Bigger float (miliseconds) should be floored too
# Bigger float (milliseconds) should be floored too
ts = utils.S3Timestamp(1.9)
self.assertEqual(expected, ts.s3xmlformat)

View File

@ -161,13 +161,13 @@ def mktime(timestamp_str, time_format='%Y-%m-%dT%H:%M:%S'):
mktime creates a float instance in epoch time really like as time.mktime
the difference from time.mktime is allowing to 2 formats string for the
argumtent for the S3 testing usage.
argument for the S3 testing usage.
TODO: support
:param timestamp_str: a string of timestamp formatted as
(a) RFC2822 (e.g. date header)
(b) %Y-%m-%dT%H:%M:%S (e.g. copy result)
:param time_format: a string of format to parase in (b) process
:param time_format: a string of format to parse in (b) process
:return : a float instance in epoch time
"""
try: