Skip to content

Commit 8770419

Browse files
committed
Remove extra check for auto_encryption_opts
Already would have failed on line 470 File "/Users/alex.clark/Developer/django-mongodb-cli/src/django-mongodb-backend/django_mongodb_backend/schema.py", line 470, in _create_collection raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Encrypted fields found but DATABASES['encrypted']['OPTIONS'] is missing auto_encryption_opts.
1 parent 870097c commit 8770419

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

django_mongodb_backend/schema.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,10 @@ def _get_encrypted_fields(
502502
path_prefix = path_prefix or ""
503503

504504
options = client._options
505-
auto_encryption_opts = getattr(options, "auto_encryption_opts", None)
505+
auto_encryption_opts = options.auto_encryption_opts
506506

507-
key_vault_collection = None
508-
if auto_encryption_opts:
509-
key_vault_db, key_vault_coll = auto_encryption_opts._key_vault_namespace.split(".", 1)
510-
key_vault_collection = client[key_vault_db][key_vault_coll]
507+
key_vault_db, key_vault_coll = auto_encryption_opts._key_vault_namespace.split(".", 1)
508+
key_vault_collection = client[key_vault_db][key_vault_coll]
511509

512510
kms_provider = router.kms_provider(model)
513511
master_key = connection.settings_dict.get("KMS_CREDENTIALS", {}).get(kms_provider)

0 commit comments

Comments
 (0)