Mercurial > piecrust2
comparison piecrust/environment.py @ 67:563ce5dd02af
I don't care what the YAML spec says, ordered maps are the only sane way.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 29 Aug 2014 16:42:15 -0700 |
parents | e52241394791 |
children | 0445a2232de7 |
comparison
equal
deleted
inserted
replaced
66:e4a24512b814 | 67:563ce5dd02af |
---|---|
1 import re | 1 import re |
2 import time | 2 import time |
3 import json | 3 import json |
4 import logging | 4 import logging |
5 import threading | 5 import threading |
6 import collections | |
6 import repoze.lru | 7 import repoze.lru |
7 | 8 |
8 | 9 |
9 logger = logging.getLogger(__name__) | 10 logger = logging.getLogger(__name__) |
10 | 11 |
38 fs_key = _make_fs_cache_key(key) | 39 fs_key = _make_fs_cache_key(key) |
39 if self.fs_cache.isValid(fs_key, fs_cache_time): | 40 if self.fs_cache.isValid(fs_key, fs_cache_time): |
40 logger.debug("'%s' found in file-system cache." % | 41 logger.debug("'%s' found in file-system cache." % |
41 key) | 42 key) |
42 item_raw = self.fs_cache.read(fs_key) | 43 item_raw = self.fs_cache.read(fs_key) |
43 item = json.loads(item_raw) | 44 item = json.loads(item_raw, |
45 object_pairs_hook=collections.OrderedDict) | |
44 self.cache.put(key, item) | 46 self.cache.put(key, item) |
45 return item | 47 return item |
46 | 48 |
47 # Look into the mem-cache. | 49 # Look into the mem-cache. |
48 logger.debug("'%s' not found in cache, must build." % key) | 50 logger.debug("'%s' not found in cache, must build." % key) |