Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

templates: Narrow the type of jinjia to Jinja2.

Zixuan James Li90a31d9e66d2
diff --git a/zerver/lib/templates.py b/zerver/lib/templates.py
index ba11237c329..d2f3ca7a95a 100644
--- a/zerver/lib/templates.py
+++ b/zerver/lib/templates.py
@@ -10,6 +10,7 @@ import orjson
from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage
from django.template import Library, engines
+from django.template.backends.jinja2 import Jinja2
from django.utils.safestring import mark_safe
from jinja2.exceptions import TemplateNotFound
@@ -156,6 +157,7 @@ def render_markdown_path(
# By default, we do both Jinja2 templating and Markdown
# processing on the file, to make it easy to use both Jinja2
# context variables and markdown includes in the file.
+ assert isinstance(jinja, Jinja2)
markdown_string = jinja.env.loader.get_source(jinja.env, markdown_file_path)[0]
except TemplateNotFound as e:
if pure_markdown: