mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 22:45:44 +00:00
Fixed 1 issue: Raise configuration error when using different backend
This commit is contained in:
parent
60ae991d70
commit
5f141abaf5
@ -142,6 +142,19 @@ class Connection(metaclass=DBSingleton):
|
||||
:exc:`~ConnectionError`: If the connection to the database
|
||||
fails.
|
||||
"""
|
||||
try:
|
||||
backend = backend
|
||||
if not backend and kwargs and kwargs.get("backend"):
|
||||
backend = kwargs["backend"]
|
||||
|
||||
if backend and backend != Config().get()["database"]["backend"]:
|
||||
Config().init_config(backend)
|
||||
else:
|
||||
backend = Config().get()["database"]["backend"]
|
||||
except KeyError:
|
||||
logger.info("Backend {} not supported".format(backend))
|
||||
raise ConfigurationError
|
||||
|
||||
for attempt in self.max_tries_counter:
|
||||
if (self.conn is None):
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user