Skip to content

Commit cdaf308

Browse files
aclark4lifeCopilot
andauthored
Update django_mongodb_backend/routers.py
Co-authored-by: Copilot <[email protected]>
1 parent fa61a7c commit cdaf308

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

django_mongodb_backend/routers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ def allow_migrate(self, db, app_label, model_name=None, **hints):
2222

2323
# This function is intended to be monkey-patched as a method of ConnectionRouter.
2424
def kms_provider(self, model, *args, **kwargs):
25+
"""
26+
Monkey-patched method for ConnectionRouter to resolve a KMS provider for a given model.
27+
Iterates through all configured database routers, calling their `kms_provider` method (if present)
28+
to determine the appropriate Key Management Service (KMS) provider for the specified model.
29+
Returns the first non-None result found. Raises ImproperlyConfigured if no provider is found.
30+
"""
2531
for router in self.routers:
2632
func = getattr(router, "kms_provider", None)
2733
if func and callable(func):

0 commit comments

Comments
 (0)