Skip to content

Commit 4e44e75

Browse files
committed
Simplify check that verifies that at least one DB is using the back-end
1 parent fe9c607 commit 4e44e75

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

psqlextra/manager/manager.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ def __init__(self, *args, **kwargs):
1919
super().__init__(*args, **kwargs)
2020

2121
# make sure our back-end is set in at least one db and refuse to proceed
22-
# if it's not set
23-
def has_pqlextra_backend():
24-
for db_alias, db_settings in settings.DATABASES.items():
25-
db_backend = db_settings['ENGINE']
26-
if "psqlextra" in db_backend:
27-
return True
28-
return False
29-
30-
if not has_pqlextra_backend():
22+
has_psqlextra_backend = any(
23+
[
24+
db_settings
25+
for db_settings in settings.DATABASES.values()
26+
if "psqlextra" in db_settings["ENGINE"]
27+
]
28+
)
29+
30+
if not has_psqlextra_backend:
3131
raise ImproperlyConfigured(
3232
(
3333
"Could not locate the 'psqlextra.backend'. "

0 commit comments

Comments
 (0)