Merge "Move utils.hash_file -> imagecache._hash_file"
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
import contextlib
|
||||
import datetime
|
||||
import functools
|
||||
import hashlib
|
||||
import inspect
|
||||
import os
|
||||
import pyclbr
|
||||
@@ -694,14 +693,6 @@ def read_cached_file(filename, cache_info, reload_func=None):
|
||||
return cache_info['data']
|
||||
|
||||
|
||||
def hash_file(file_like_object):
|
||||
"""Generate a hash for the contents of a file."""
|
||||
checksum = hashlib.sha1()
|
||||
for chunk in iter(lambda: file_like_object.read(32768), b''):
|
||||
checksum.update(chunk)
|
||||
return checksum.hexdigest()
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def temporary_mutation(obj, **kwargs):
|
||||
"""Temporarily set the attr on a particular object to a given value then
|
||||
|
||||
Reference in New Issue
Block a user