Skip to content
Browse files

Add recognition of Beaker's 'enabled' option for cache regions.

  • Loading branch information...
1 parent ab135f5 commit 2b78782ed32e8ac3cf733c0f07e8586418446bbb @rbcarson rbcarson committed
Showing with 10 additions and 0 deletions.
  1. +2 −0 CONTRIBUTORS.txt
  2. +3 −0 docs/index.rst
  3. +5 −0 pyramid_beaker/__init__.py
View
2 CONTRIBUTORS.txt
@@ -115,3 +115,5 @@ Contributors
- Joachim Krebs 2011/01/03
- Wichert Akkerman, 29-04-2011
+
+- Carson Lam, 2011/07/16
View
3 docs/index.rst
@@ -125,6 +125,9 @@ Inherited region settings
The following optional region settings inherit from the main cache
configuration or default as specified:
+``enabled``
+ Inherits or defaults to True.
+
``expire``
Inherits or defaults to 60 seconds.
View
5 pyramid_beaker/__init__.py
@@ -144,6 +144,11 @@ def set_cache_regions_from_settings(settings):
if key.startswith(region):
region_settings[key.split('.')[1]] = value
region_settings['expire'] = int(region_settings.get('expire', 60))
+ if 'enabled' not in region_settings:
+ enabled_value_source = cache_settings
+ else:
+ enabled_value_source = region_settings
+ region_settings['enabled'] = enabled_value_source.get('enabled', 'true').lower() == 'true'
if 'lock_dir' not in region_settings:
region_settings['lock_dir'] = cache_settings.get('lock_dir')
if 'type' not in region_settings:

0 comments on commit 2b78782

Please sign in to comment.
Something went wrong with that request. Please try again.