]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
FileSystemLoader includes search paths in error
authorYourun-Proger <shkrobov.yura@mail.ru>
Mon, 2 May 2022 12:42:19 +0000 (15:42 +0300)
committerDavid Lord <davidism@gmail.com>
Fri, 20 Dec 2024 03:33:29 +0000 (19:33 -0800)
CHANGES.rst
src/jinja2/loaders.py

index 384c6122d422b5ac3d2fedf3414ff35eebd75ffb..569ae69f778cf72fcd5e03eb33fff551eb383bcd 100644 (file)
@@ -35,6 +35,8 @@ Unreleased
 -   Fix `copy`/`pickle` support for the internal ``missing`` object.
     :issue:`2027`
 -   ``Environment.overlay(enable_async)`` is applied correctly. :pr:`2061`
+-   Paths where the loader searched for the template were added
+    to the error message. :issue:`1661`
 
 
 Version 3.1.4
index d2373e5e7f77cd6fe76da00534bab75d1c3a1f5d..65dfbe1a0eaed79297fc3ba5e942cce2dcdabdf6 100644 (file)
@@ -204,7 +204,10 @@ class FileSystemLoader(BaseLoader):
             if os.path.isfile(filename):
                 break
         else:
-            raise TemplateNotFound(template)
+            raise TemplateNotFound(
+                f"{template} not found in the following search path(s):"
+                f" {self.searchpath}"
+            )
 
         with open(filename, encoding=self.encoding) as f:
             contents = f.read()