~ubuntu-branches/ubuntu/trusty/beaker/trusty

« back to all changes in this revision

Viewing changes to beaker/cache.py

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2008-11-25 08:15:08 UTC
  • mfrom: (1.1.10 upstream) (2.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20081125081508-v79xm1n3tz6l7dwa
Tags: 1.1.2-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
try:
20
20
    import beaker.ext.memcached as memcached
21
21
    clsmap['ext:memcached'] = memcached.MemcachedNamespaceManager
22
 
except InvalidCacheBackendError:
23
 
    pass
 
22
except InvalidCacheBackendError, e:
 
23
    clsmap['ext:memcached'] = e
24
24
 
25
25
try:
26
26
    import beaker.ext.database as database
27
27
    clsmap['ext:database'] = database.DatabaseNamespaceManager
28
 
except InvalidCacheBackendError:
29
 
    pass
 
28
except InvalidCacheBackendError, e:
 
29
    clsmap['ext:database'] = e
30
30
 
31
31
try:
32
32
    import beaker.ext.sqla as sqla
33
33
    clsmap['ext:sqla'] = sqla.SqlaNamespaceManager
34
 
except InvalidCacheBackendError:
35
 
    pass
 
34
except InvalidCacheBackendError, e:
 
35
    clsmap['ext:sqla'] = e
36
36
 
37
37
try:
38
38
    import beaker.ext.google as google
39
39
    clsmap['ext:google'] = google.GoogleNamespaceManager
40
 
except (InvalidCacheBackendError, SyntaxError):
41
 
    pass
 
40
except (InvalidCacheBackendError, SyntaxError), e:
 
41
    clsmap['ext:google'] = e
42
42
 
43
43
 
44
44
class Cache(object):
47
47
    def __init__(self, namespace, type='memory', expiretime=None, starttime=None, **nsargs):
48
48
        try:
49
49
            cls = clsmap[type]
 
50
            if isinstance(cls, InvalidCacheBackendError):
 
51
                raise cls
50
52
        except KeyError:
51
53
            raise TypeError("Unknown cache implementation %r" % type)
52
54