1. Marcin Kuzminski
  2. beaker

Commits

Michael Merickel  committed 2d3a565

Fixed a corner-case of an empty-string region name.

  • Participants
  • Parent commits b8d09d9
  • Branches default

Comments (0)

Files changed (1)

File beaker/util.py

View file
     if regions:
         region_configs = {}
         for region in regions:
+            if not region: # ensure region name is valid
+                continue
             # Setup the default cache options
             region_options = dict(data_dir=options.get('data_dir'),
                                   lock_dir=options.get('lock_dir'),
                                   enabled=options['enabled'],
                                   expire=options.get('expire'),
                                   key_length=options.get('key_length', 250))
-            region_len = len(region) + 1
+            region_prefix = '%s.' % region
+            region_len = len(region_prefix)
             for key in options.keys():
-                if key.startswith('%s.' % region):
+                if key.startswith(region_prefix):
                     region_options[key[region_len:]] = options.pop(key)
             coerce_cache_params(region_options)
             region_configs[region] = region_options