]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
check for if loader does not implement get_source()
authorWing <steely.wing@gmail.com>
Sat, 17 May 2014 05:42:53 +0000 (13:42 +0800)
committerWing <steely.wing@gmail.com>
Sat, 17 May 2014 05:42:53 +0000 (13:42 +0800)
jinja2/environment.py

index 7bf8b319c2485d828d2041416820ffcf01bf2196..afef6b8e2edd223a03dd73addd4a45da32c4e006 100644 (file)
@@ -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