summaryrefslogtreecommitdiff
path: root/swiftclient/service.py
diff options
context:
space:
mode:
authorCheng Li <shcli@cn.ibm.com>2016-05-31 14:32:58 +0800
committerCheng Li <shcli@cn.ibm.com>2016-06-02 22:53:18 +0800
commit69bf4634b972ef2ee0ec1f015d71223203f0bb1a (patch)
tree7284f413432d077860a12634419a279deb7bd634 /swiftclient/service.py
parentf9d0657e70e9511a2d7b4c63bbf06b138dd0be5e (diff)
downloadpython-swiftclient-69bf4634b972ef2ee0ec1f015d71223203f0bb1a.tar.gz
Add an option: disable etag check on downloads
This patch is to add an option of disable etag check on downloads. Change-Id: I9ad389dd691942dea6db470ca3f0543eb6e9703e Closes-bug: #1581147
Diffstat (limited to 'swiftclient/service.py')
-rw-r--r--swiftclient/service.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/swiftclient/service.py b/swiftclient/service.py
index 12d3f21..6ccba55 100644
--- a/swiftclient/service.py
+++ b/swiftclient/service.py
@@ -336,7 +336,7 @@ class _SwiftReader(object):
errors on failures caused by either invalid md5sum or size of the
data read.
"""
- def __init__(self, path, body, headers):
+ def __init__(self, path, body, headers, checksum=True):
self._path = path
self._body = body
self._actual_read = 0
@@ -345,7 +345,7 @@ class _SwiftReader(object):
self._expected_etag = headers.get('etag')
if ('x-object-manifest' not in headers
- and 'x-static-large-object' not in headers):
+ and 'x-static-large-object' not in headers and checksum):
self._actual_md5 = md5()
if 'content-length' in headers:
@@ -980,6 +980,7 @@ class SwiftService(object):
'header': [],
'skip_identical': False,
'out_directory': None,
+ 'checksum': True,
'out_file': None,
'remove_prefix': False,
'shuffle' : False
@@ -1135,7 +1136,8 @@ class SwiftService(object):
headers_receipt = time()
- obj_body = _SwiftReader(path, body, headers)
+ obj_body = _SwiftReader(path, body, headers,
+ options.get('checksum', True))
no_file = options['no_download']
if out_file == "-" and not no_file: