allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [allura] 01/01: [#8355] Py3 compatibility for memcached-backed jinja bytecode
Date Fri, 27 Mar 2020 14:24:35 GMT
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch kt/8355
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 85dccfeed3953bc7511192c6e295b9dd9eb63df1
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
AuthorDate: Fri Mar 27 14:24:17 2020 +0000

    [#8355] Py3 compatibility for memcached-backed jinja bytecode
---
 Allura/allura/config/app_cfg.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index 91f89cf..f795f2c 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -34,6 +34,8 @@ from __future__ import unicode_literals
 from __future__ import absolute_import
 import logging
 from functools import partial
+import six
+import sys
 
 import tg
 from tg import app_globals as g
@@ -84,7 +86,10 @@ class AlluraJinjaRenderer(JinjaRenderer):
                 import pylibmc
                 from jinja2 import MemcachedBytecodeCache
                 client = pylibmc.Client([config['memcached_host']])
-                bcc = MemcachedBytecodeCache(client, prefix='jinja2/{}/'.format(jinja2.__version__))
+                bcc_prefix = 'jinja2/{}/'.format(jinja2.__version__)
+                if six.PY3:
+                    bcc_prefix += 'py{}{}/'.format(sys.version_info.major, sys.version_info.minor)
+                bcc = MemcachedBytecodeCache(client, prefix=bcc_prefix)
             elif cache_type == 'filesystem':
                 from jinja2 import FileSystemBytecodeCache
                 bcc = FileSystemBytecodeCache(pattern='__jinja2_{}_%s.cache'.format(jinja2.__version__))


Mime
View raw message