You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2012/10/26 21:33:22 UTC

[22/26] git commit: [#5107] fix error handling text around jinja BytecodeCache handling

[#5107] fix error handling text around jinja BytecodeCache handling


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/01039d8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/01039d8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/01039d8a

Branch: refs/heads/cj/4942
Commit: 01039d8a28e6e88f426132d1c0af75aa55dfaffe
Parents: f88173a
Author: Dave Brondsema <db...@geek.net>
Authored: Mon Oct 15 18:53:27 2012 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Mon Oct 15 18:53:27 2012 +0000

----------------------------------------------------------------------
 Allura/allura/config/app_cfg.py |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01039d8a/Allura/allura/config/app_cfg.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index aef1e6c..428c339 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -58,26 +58,18 @@ class ForgeConfig(AppConfig):
     def _setup_bytecode_cache(self):
         cache_type = config.get('jinja_bytecode_cache_type')
         bcc = None
-        if cache_type == 'memcached' and config.get('memcached_host'):
-            try:
+        try:
+            if cache_type == 'memcached' and config.get('memcached_host'):
                 import pylibmc
                 from jinja2 import MemcachedBytecodeCache
                 client = pylibmc.Client([config['memcached_host']])
                 bcc = MemcachedBytecodeCache(client)
-            except:
-                log.exception("Error encountered while setting up a" +
-                        " filesystem-backed bytecode cache for Jinja.")
-        elif cache_type == 'filesystem':
-            try:
+            elif cache_type == 'filesystem':
                 from jinja2 import FileSystemBytecodeCache
                 bcc = FileSystemBytecodeCache()
-            except ImportError:
-                log.exception("pylibmc is a required dependency when" +
-                        " using a memcached-backed bytecode cache for" +
-                        " Jinja")
-            except:
-                log.exception("Error encountered while setting up a" +
-                        " memcached-backed bytecode cache for Jinja")
+        except:
+            log.exception("Error encountered while setting up a" +
+                        " %s-backed bytecode cache for Jinja" % cache_type)
         return bcc
 
     def setup_jinja_renderer(self):