Skip to content

Commit ed54a9b

Browse files
committed
Rename get_encrypted_client -> get_client_encryption
1 parent 4da895c commit ed54a9b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

django_mongodb_backend/encryption.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pymongo.encryption import AutoEncryptionOpts, ClientEncryption
99

1010

11-
def get_encrypted_client(auto_encryption_opts, encrypted_connection):
11+
def get_client_encryption(auto_encryption_opts, encrypted_connection):
1212
"""
1313
Returns a `ClientEncryption` instance for MongoDB Client-Side Field Level
1414
Encryption (CSFLE) that can be used to create an encrypted collection.

django_mongodb_backend/schema.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.db.models import Index, UniqueConstraint
33
from pymongo.operations import SearchIndexModel
44

5-
from .encryption import get_encrypted_client
5+
from .encryption import get_client_encryption
66
from .fields import EmbeddedModelField
77
from .indexes import SearchIndex
88
from .query import wrap_database_errors
@@ -421,18 +421,16 @@ def _field_should_have_unique(self, field):
421421

422422
def _create_collection(self, model):
423423
"""
424-
Create a collection or, if encryption is supported, create
425-
an encrypted client then use that to create an encrypted
426-
collection.
424+
Create a collection or encrypted collection for the model.
427425
"""
428426

429427
if hasattr(model, "encrypted_fields_map"):
430428
auto_encryption_opts = self.connection.settings_dict.get("OPTIONS", {}).get(
431429
"auto_encryption_opts"
432430
)
433431
client = self.connection.connection
434-
encrypted_client = get_encrypted_client(auto_encryption_opts, client)
435-
encrypted_client.create_encrypted_collection(
432+
client_encryption = get_client_encryption(auto_encryption_opts, client)
433+
client_encryption.create_encrypted_collection(
436434
client.database,
437435
model._meta.db_table,
438436
model.encrypted_fields_map,

0 commit comments

Comments
 (0)