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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user