diff options
Diffstat (limited to 'fatcat_scholar/hacks.py')
-rw-r--r-- | fatcat_scholar/hacks.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fatcat_scholar/hacks.py b/fatcat_scholar/hacks.py index fc1dacd..710a25f 100644 --- a/fatcat_scholar/hacks.py +++ b/fatcat_scholar/hacks.py @@ -1,10 +1,10 @@ - import typing import jinja2 from starlette.background import BackgroundTask from starlette.templating import _TemplateResponse + class Jinja2Templates: """ This is a patched version of starlette.templating.Jinja2Templates that @@ -15,7 +15,9 @@ class Jinja2Templates: assert jinja2 is not None, "jinja2 must be installed to use Jinja2Templates" self.env = self.get_env(directory, extensions) - def get_env(self, directory: str, extensions: typing.List[str] = []) -> "jinja2.Environment": + def get_env( + self, directory: str, extensions: typing.List[str] = [] + ) -> "jinja2.Environment": @jinja2.contextfunction def url_for(context: dict, name: str, **path_params: typing.Any) -> str: request = context["request"] |