mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +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
|
:exc:`~ConnectionError`: If the connection to the database
|
||||||
fails.
|
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:
|
for attempt in self.max_tries_counter:
|
||||||
if (self.conn is None):
|
if (self.conn is None):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user