Mercurial > piecrust2
diff piecrust/environment.py @ 336:aa6b7ff6a193
internal: Use hashes for cache paths.
This will prevent collisions (_e.g._ between `foo/bar` and `foo_bar`), and
generating paths that are too long and exceed OS limits.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 03 Apr 2015 11:22:51 -0700 |
parents | 1187739e5a19 |
children | c2ca72fb7f0b |
line wrap: on
line diff
--- a/piecrust/environment.py Fri Apr 03 11:20:30 2015 -0700 +++ b/piecrust/environment.py Fri Apr 03 11:22:51 2015 -0700 @@ -2,6 +2,7 @@ import time import json import logging +import hashlib import threading import contextlib import collections @@ -15,7 +16,7 @@ def _make_fs_cache_key(key): - return re_fs_cache_key.sub('_', key) + return hashlib.md5(key.encode('utf8')).hexdigest() class MemCache(object):