Skip to content

Commit

Permalink
added some safety checks
Browse files Browse the repository at this point in the history
  • Loading branch information
amirreza8002 committed Dec 28, 2024
1 parent ab143c6 commit 779dff7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions django_valkey/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ def get_connection_factory(
) -> ConnectionFactory | SentinelConnectionFactory | Any:

path = getattr(settings, "DJANGO_VALKEY_CONNECTION_FACTORY", path)
opt_conn_factory = options.get("CONNECTION_FACTORY")
if opt_conn_factory:
path = opt_conn_factory
if options:
opt_conn_factory = options.get("CONNECTION_FACTORY")
if opt_conn_factory:
path = opt_conn_factory

if not path:
raise AttributeError("connection factory path is not provided")
cls = import_string(path)
return cls(options)

0 comments on commit 779dff7

Please sign in to comment.