File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,13 @@ def parse(uri):
31
31
host = None
32
32
port = None
33
33
34
- if uri ["fqdn" ] is None :
35
- # If fqdn is None this is not a SRV URI so extract host and port from
36
- # the first node in nodelist.
37
- host , port = [f"{ node [0 ]} :{ node [1 ]} " for node in uri ["nodelist" ]][0 ].split (":" )
38
- else :
39
- # The fqdn is not none so we need to add the mongodb+srv:// prefix to
40
- # the host.
34
+ if uri ["fqdn" ] is not None :
35
+ # If the fqdn is present, this is a SRV URI and the host is the fqdn.
41
36
host = f"mongodb+srv://{ uri ['fqdn' ]} "
37
+ else :
38
+ # If the fqdn is not present, this is a standard URI and the host and
39
+ # port are in the nodelist.
40
+ host , port = [f"{ node [0 ]} :{ node [1 ]} " for node in uri ["nodelist" ]].next ().split (":" )
42
41
43
42
settings_dict = {
44
43
"ENGINE" : "django_mongodb" ,
You can’t perform that action at this time.
0 commit comments