File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ def check_django_compatability():
2828
2929def parse (uri , ** kwargs ):
3030 uri = parse_uri (uri )
31+
3132 host = None
3233 port = None
3334
@@ -37,20 +38,18 @@ def parse(uri, **kwargs):
3738 else :
3839 # If the fqdn is not present, this is a standard URI and the host and
3940 # port are in the nodelist.
40- host , port = [f"{ node [0 ]} :{ node [1 ]} " for node in uri ["nodelist" ]]. next (). split (":" )
41+ host , port = [f"{ node [0 ]} :{ node [1 ]} " for node in uri ["nodelist" ]][ 0 ]. split (":" ) # noqa: RUF015
4142
4243 settings_dict = {
4344 "ENGINE" : "django_mongodb" ,
4445 "NAME" : uri ["database" ],
4546 "HOST" : host ,
47+ "PORT" : port ,
4648 "USER" : uri .get ("username" ),
4749 "PASSWORD" : uri .get ("password" ),
4850 "OPTIONS" : uri .get ("options" ),
4951 }
5052
51- if port :
52- settings_dict ["PORT" ] = port
53-
5453 if kwargs :
5554 settings_dict .update (kwargs )
5655
You can’t perform that action at this time.
0 commit comments