You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/03/10 16:12:01 UTC
[allura] 09/14: [#8354] make sure jinja2 config values are of the
right type
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/8354
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 9ad5f3d8ac13c359232ab533821a0f6ddcd4241d
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Fri Mar 6 17:33:10 2020 -0500
[#8354] make sure jinja2 config values are of the right type
---
Allura/allura/config/app_cfg.py | 3 ++-
Allura/allura/config/middleware.py | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index fc9eb3e..91f89cf 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -42,6 +42,7 @@ import jinja2
from tg.configuration import AppConfig, config
from markupsafe import Markup
import ew
+from tg.support.converters import asint
import allura
# needed for tg.configuration to work
@@ -103,7 +104,7 @@ class AlluraJinjaRenderer(JinjaRenderer):
auto_reload=config['auto_reload_templates'],
autoescape=True,
bytecode_cache=bcc,
- cache_size=config.get('jinja_cache_size', -1),
+ cache_size=asint(config.get('jinja_cache_size', -1)),
extensions=['jinja2.ext.do', 'jinja2.ext.i18n'])
jinja2_env.install_gettext_translations(tg.i18n)
jinja2_env.filters['datetimeformat'] = helpers.datetimeformat
diff --git a/Allura/allura/config/middleware.py b/Allura/allura/config/middleware.py
index af52386..b46ee1b 100644
--- a/Allura/allura/config/middleware.py
+++ b/Allura/allura/config/middleware.py
@@ -175,9 +175,9 @@ def _make_core_app(root, global_conf, full_stack=True, **app_conf):
# (the Allura [easy_widgets.engines] entry point is named "jinja" (not jinja2) but it doesn't need
# any settings since it is a class that uses the same jinja env as the rest of allura)
**{
- 'jinja2.auto_reload': config['auto_reload_templates'],
+ 'jinja2.auto_reload': asbool(config['auto_reload_templates']),
'jinja2.bytecode_cache': AlluraJinjaRenderer._setup_bytecode_cache(),
- 'jinja2.cache_size': config.get('jinja_cache_size', -1),
+ 'jinja2.cache_size': asint(config.get('jinja_cache_size', -1)),
}
)
# Handle static files (by tool)