Skip to content

Commit

Permalink
Hash the file path in the mtime cache key.
Browse files Browse the repository at this point in the history
  • Loading branch information
jezdez committed Feb 10, 2011
1 parent 975bffc commit efa4c43
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions compressor/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

0 comments on commit efa4c43

Please sign in to comment.