diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-02-20 19:55:06 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-02-20 19:55:06 -0500 |
| commit | 6cc1d50c14f121d341a3d25fcb0681eafea46a2c (patch) | |
| tree | e3be764ade34b38ee6a5ee6f6bf67888b4bd1eba /mako/lookup.py | |
| parent | 6c06a3270b6fca6d959fff4c81cf932e17a475d2 (diff) | |
| download | external_python_mako-6cc1d50c14f121d341a3d25fcb0681eafea46a2c.tar.gz external_python_mako-6cc1d50c14f121d341a3d25fcb0681eafea46a2c.tar.bz2 external_python_mako-6cc1d50c14f121d341a3d25fcb0681eafea46a2c.zip | |
- use deque instead of list for FastEncodingBuffer
- don't call os.stat twice !
- tee hee !
Diffstat (limited to 'mako/lookup.py')
| -rw-r--r-- | mako/lookup.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/mako/lookup.py b/mako/lookup.py index 7450700..d3763d6 100644 --- a/mako/lookup.py +++ b/mako/lookup.py @@ -287,16 +287,20 @@ class TemplateLookup(TemplateCollection): def _check(self, uri, template): if template.filename is None: return template - if not os.path.exists(template.filename): + + try: + template_stat = os.stat(template.filename) + if template.module._modified_time < \ + template_stat[stat.ST_MTIME]: + self._collection.pop(uri, None) + return self._load(template.filename, uri) + else: + return template + except OSError: self._collection.pop(uri, None) raise exceptions.TemplateLookupException( "Cant locate template for uri %r" % uri) - elif template.module._modified_time < \ - os.stat(template.filename)[stat.ST_MTIME]: - self._collection.pop(uri, None) - return self._load(template.filename, uri) - else: - return template + def put_string(self, uri, text): """Place a new :class:`.Template` object into this |
