mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #16410 -- Fixed get_cache to behave gracefully when given a string that can't be split. Thanks, jedie.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16511 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
6
django/core/cache/__init__.py
vendored
6
django/core/cache/__init__.py
vendored
@@ -126,12 +126,12 @@ def parse_backend_conf(backend, **kwargs):
|
||||
location = args.pop('LOCATION', '')
|
||||
return backend, location, args
|
||||
else:
|
||||
# Trying to import the given backend, in case it's a dotted path
|
||||
mod_path, cls_name = backend.rsplit('.', 1)
|
||||
try:
|
||||
# Trying to import the given backend, in case it's a dotted path
|
||||
mod_path, cls_name = backend.rsplit('.', 1)
|
||||
mod = importlib.import_module(mod_path)
|
||||
backend_cls = getattr(mod, cls_name)
|
||||
except (AttributeError, ImportError):
|
||||
except (AttributeError, ImportError, ValueError):
|
||||
raise InvalidCacheBackendError("Could not find backend '%s'" % backend)
|
||||
location = kwargs.pop('LOCATION', '')
|
||||
return backend, location, kwargs
|
||||
|
||||
Reference in New Issue
Block a user