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):
3131 host = None
3232 port = None
3333
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.
4136 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 (":" )
4241
4342 settings_dict = {
4443 "ENGINE" : "django_mongodb" ,
You can’t perform that action at this time.
0 commit comments