Rename wrap_with_hash to a more generic wrap_with_handler

This commit is contained in:
Joseph Schorr 2015-08-25 15:53:13 -04:00
parent d9973af1df
commit 84458811d5
2 changed files with 5 additions and 4 deletions

View file

@ -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,

View file

@ -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