@@ -26,7 +26,7 @@ def check_django_compatability():
26
26
)
27
27
28
28
29
- def parse_uri (uri , engine = "django_mongodb" , conn_max_age = None , conn_health_checks = None , test = None ):
29
+ def parse_uri (uri , conn_max_age = 0 , conn_health_checks = False , test = None ):
30
30
"""
31
31
Parse a MongoDB URI and return a dictionary of Django database
32
32
settings. This function is a wrapper around PyMongo's
@@ -49,22 +49,18 @@ def parse_uri(uri, engine="django_mongodb", conn_max_age=None, conn_health_check
49
49
host = "," .join ([f"{ host } :{ port } " for host , port in nodelist ])
50
50
51
51
settings_dict = {
52
- "ENGINE" : engine ,
52
+ "ENGINE" : "django_mongodb" ,
53
53
"NAME" : uri ["database" ],
54
54
"HOST" : host ,
55
55
"PORT" : port ,
56
56
"USER" : uri .get ("username" ),
57
57
"PASSWORD" : uri .get ("password" ),
58
58
"OPTIONS" : uri .get ("options" ),
59
+ "CONN_MAX_AGE" : conn_max_age ,
60
+ "CONN_HEALTH_CHECKS" : conn_health_checks ,
59
61
}
60
62
61
- if conn_max_age is not None :
62
- settings_dict ["CONN_MAX_AGE" ] = conn_max_age
63
-
64
- if conn_health_checks is not None :
65
- settings_dict ["CONN_HEALTH_CHECKS" ] = conn_health_checks
66
-
67
- if test is not None :
63
+ if test :
68
64
settings_dict ["TEST" ] = test
69
65
70
66
return settings_dict
0 commit comments