Hash the file path in the mtime cache key.

This commit is contained in:
Jannis Leidel
2011-02-10 04:20:45 +01:00
parent 975bffc518
commit efa4c4357a

View File

@@ -10,11 +10,11 @@ def get_hexdigest(plaintext):
return sha_constructor(plaintext).hexdigest()
def get_mtime_cachekey(filename):
return "django_compressor.mtime.%s" % filename
return "django_compressor.mtime.%s" % get_hexdigest(filename)
def get_offline_cachekey(source):
return ("django_compressor.offline.%s"
% get_hexdigest("".join(smart_str(s) for s in source)))
return ("django_compressor.offline.%s" %
get_hexdigest("".join(smart_str(s) for s in source)))
def get_mtime(filename):
if settings.COMPRESS_MTIME_DELAY:
@@ -31,5 +31,4 @@ def get_hashed_mtime(filename, length=12):
mtime = str(int(get_mtime(filename)))
return get_hexdigest(mtime)[:length]
cache = get_cache(settings.COMPRESS_CACHE_BACKEND)