diff options
author | Wing <steely.wing@gmail.com> | 2014-05-17 13:42:53 +0800 |
---|---|---|
committer | Wing <steely.wing@gmail.com> | 2014-05-17 13:42:53 +0800 |
commit | 1abbe4dd842ac78df2deeb05342d3a7bb24386a2 (patch) | |
tree | d2a54cfadbca249ddd5ae29a16463a0e21abab5d /jinja2/environment.py | |
parent | 15c02ae4d7b854d7baa81592dfe308bfcd933287 (diff) | |
download | jinja2-1abbe4dd842ac78df2deeb05342d3a7bb24386a2.tar.gz |
check for if loader does not implement get_source()
Diffstat (limited to 'jinja2/environment.py')
-rw-r--r-- | jinja2/environment.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/jinja2/environment.py b/jinja2/environment.py index 7bf8b31..afef6b8 100644 --- a/jinja2/environment.py +++ b/jinja2/environment.py @@ -757,8 +757,12 @@ class Environment(object): def _load_template(self, name, globals): if self.loader is None: raise TypeError('no loader for this environment specified') - # use abs path for cache key - _, cache_key, _ = self.loader.get_source(self, name) + try: + # use abs path for cache key + _, cache_key, _ = self.loader.get_source(self, name) + except RuntimeError: + # if loader does not implement get_source() + cache_key = None # if template is not file, use name for cache key if cache_key is None: cache_key = name |