Skip to content
Myr

Added a way to disable memcache error ignoring and documented the change. Also changed a bare except to an except on the exception type.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 8fea62d · Browse files · 2 files+14 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−4 removed

  • other:+14 added−4 removed

2 files+14 added−4 removed

modified:jinja2/bccache.py+13 added-4 removed
279 unmodified lines
280 the cache system. We recommend a high (or no) timeout.281282 This bytecode cache does not support clearing of used items in the cache.283 The clear method is a no-operation function.284285 .. versionadded:: 2.7286 Added support for ignoring memcache errors through the287 `ignore_memcache_errors` parameter.288 """289286 def __init__(self, client, prefix='jinja2/bytecode/', timeout=None):290 def __init__(self, client, prefix='jinja2/bytecode/', timeout=None,291 ignore_memcache_errors=True):292 self.client = client293 self.prefix = prefix294 self.timeout = timeout295 self.ignore_memcache_errors = ignore_memcache_errors296297 def load_bytecode(self, bucket):298 try:299 code = self.client.get(self.prefix + bucket.key)294 except:300 except Exception:301 if not self.ignore_memcache_errors:302 raise303 code = None304 if code is not None:305 bucket.bytecode_from_string(code)306
2 unmodified lines
309 if self.timeout is not None:310 args += (self.timeout,)311 try:312 self.client.set(*args)305 except:306 pass313 except Exception:314 if not self.ignore_memcache_errors:315 raise
modified:CHANGES+1 added
18 unmodified lines
19 supported by same source code, using the "six" compatibility library.20- Allow `contextfunction` and other decorators to be applied to `__call__`.21- Added support for changing from newline to different signs in the `wordwrap`22 filter.23- Added support for ignoring memcache errors silently.2425Version 2.626-----------27(codename Convolution, released on July 24th 2011)
263 unmodified lines