allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [allura] 11/16: [#8354] make sure jinja2 config values are of the right type
Date Tue, 10 Mar 2020 15:58:59 GMT
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 670f81c2661f57425ea92321c6d0596e54b78ecf
Author: Dave Brondsema <dave@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)


Mime
View raw message