From 17516bbbdd19ec9df11dcf7450243f0492ef58da Mon Sep 17 00:00:00 2001
From: Mike Bayer <mike_mp@zzzcomputing.com>
Date: Thu, 10 Jul 2008 15:35:40 +0000
Subject: [PATCH] - cache module now uses Beaker's clsmap to get at container
 classes, so cache types such as "ext:google", "ext:sqla", etc. are available.
 memcached is available as both "ext:memcached" and "memcached", the latter
 for backwards compatibility.

---
 CHANGES           |  8 +++++++-
 lib/mako/cache.py | 21 +++++----------------
 2 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/CHANGES b/CHANGES
index c2b1b09..a559672 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,10 @@
-0.2.3 
+0.2.3
+- cache module now uses Beaker's clsmap to get at 
+container classes, so cache types such as 
+"ext:google", "ext:sqla", etc. are available.  
+memcached is available as both "ext:memcached" and
+"memcached", the latter for backwards compatibility.
+
 - fixed the html_error_template not handling tracebacks from
 normal .py files with a magic encoding comment [ticket:88]
 
diff --git a/lib/mako/cache.py b/lib/mako/cache.py
index ea96d1e..3332585 100644
--- a/lib/mako/cache.py
+++ b/lib/mako/cache.py
@@ -1,22 +1,11 @@
 from mako import exceptions
 
 try:
-    import beaker.container as container
-    import beaker.exceptions
-    clsmap = {
-        'memory':container.MemoryContainer,
-        'dbm':container.DBMContainer,
-        'file':container.FileContainer,
-    }
-    try:
-        import beaker.ext.memcached as memcached
-        # XXX HACK: Python 2.3 under some circumstances will import this module
-        #           even though there's no memcached. This ensures its really
-        #           there before adding it.
-        if hasattr(memcached, 'MemcachedContainer'):
-            clsmap['memcached'] = memcached.MemcachedContainer
-    except beaker.exceptions.BeakerException:
-        pass
+    from beaker import container, exceptions, cache
+    clsmap = cache.clsmap
+
+    if 'ext:memcached' in clsmap:
+        clsmap['memcached'] = clsmap['ext:memcached']
 except ImportError:
     container = None
     clsmap = {}
-- 
GitLab