Add stronger checking of backend configuration

Set a default if the backend configuration is not
provided as well as check for the configuration
being a dictionary instead of any arbitary non-false
type.

Change-Id: Id458ac0eb2d7b86c5602ed2f23a52fb2c6f6f0e7
This commit is contained in:
Joshua Harlow
2013-12-30 14:06:38 -08:00
parent 9632fe6392
commit 5bba657a84

View File

@@ -26,6 +26,11 @@ class Backend(object):
"""Base class for persistence backends."""
def __init__(self, conf):
if not conf:
conf = {}
if not isinstance(conf, dict):
raise TypeError("Configuration dictionary expected not: %s"
% type(conf))
self._conf = conf
@abc.abstractmethod