From 84458811d58faa18ae78ac8bbe98df73830faf90 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 25 Aug 2015 15:53:13 -0400 Subject: [PATCH] Rename wrap_with_hash to a more generic wrap_with_handler --- endpoints/v2/blob.py | 5 +++-- util/registry/filelike.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/endpoints/v2/blob.py b/endpoints/v2/blob.py index 8e6ac3bb0..705794b6b 100644 --- a/endpoints/v2/blob.py +++ b/endpoints/v2/blob.py @@ -14,7 +14,7 @@ from endpoints.v2.errors import BlobUnknown, BlobUploadInvalid, BlobUploadUnknow from auth.jwt_auth import process_jwt_auth from endpoints.decorators import anon_protect from util.cache import cache_control -from util.registry.filelike import wrap_with_hash +from util.registry.filelike import wrap_with_handler from storage.basestorage import InvalidChunkException @@ -201,7 +201,8 @@ def _upload_chunk(namespace, repo_name, upload_uuid): except _InvalidRangeHeader: _range_not_satisfiable(found.byte_count) - input_fp = wrap_with_hash(get_input_stream(request), found.sha_state) + input_fp = get_input_stream(request) + input_fp = wrap_with_handler(input_fp, found.sha_state.update) try: length_written = storage.stream_upload_chunk({found.location.name}, upload_uuid, start_offset, diff --git a/util/registry/filelike.py b/util/registry/filelike.py index 758c5889f..73dc9b9d2 100644 --- a/util/registry/filelike.py +++ b/util/registry/filelike.py @@ -18,7 +18,7 @@ class SocketReader(object): raise IOError('Stream is not seekable.') -def wrap_with_hash(in_fp, hash_obj): +def wrap_with_handler(in_fp, handler): wrapper = SocketReader(in_fp) - wrapper.add_handler(hash_obj.update) + wrapper.add_handler(handler) return wrapper