summaryrefslogtreecommitdiffstats
path: root/contrib/python/Jinja2/py3/patches/04-fix-PackageLoader-2.patch
blob: d130ba0fbdad2c740d348f566bb4d935ea2b0bb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- contrib/python/Jinja2/py3/jinja2/loaders.py	(index)
+++ contrib/python/Jinja2/py3/jinja2/loaders.py	(working tree)
@@ -310,6 +310,7 @@ class PackageLoader(BaseLoader):
         package_path: "str" = "templates",
         encoding: str = "utf-8",
         skip_unknown_package: bool = False,
+        check_templates: bool = False,
     ) -> None:
         package_path = os.path.normpath(package_path).rstrip(os.path.sep)
 
@@ -340,7 +341,7 @@ class PackageLoader(BaseLoader):
         self._loader = loader
         self._archive = None
         self._package = package
-        self._check_templates = False
+        self._check_templates = check_templates
 
         if isinstance(loader, zipimport.zipimporter):
             self._archive = loader.archive
--- contrib/python/Jinja2/py3/tests/test_loader.py	(index)
+++ contrib/python/Jinja2/py3/tests/test_loader.py	(working tree)
@@ -436,4 +436,4 @@ def test_pep_451_import_hook():
 
 def test_package_loader_no_dir() -> None:
     with pytest.raises(ValueError, match="could not find a 'templates' directory"):
-        PackageLoader("jinja2")
+        PackageLoader("jinja2", check_templates=True)