File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -28,15 +28,18 @@ def check_django_compatability():
2828
2929def parse (uri ):
3030 uri = parse_uri (uri )
31- name = None
3231 port = None
3332
3433 if uri ["fqdn" ] is None :
3534 # If fqdn is None then this is not a SRV URI, so we need to extract the
3635 # port from the first node in the nodelist.
3736 if "nodelist" in uri and isinstance (uri ["nodelist" ], list ) and len (uri ["nodelist" ]) > 0 :
3837 first_node = uri ["nodelist" ][0 ]
39- if isinstance (first_node , tuple ) and len (first_node ) > 1 and isinstance (first_node [1 ], int ):
38+ if (
39+ isinstance (first_node , tuple )
40+ and len (first_node ) > 1
41+ and isinstance (first_node [1 ], int )
42+ ):
4043 port = first_node [1 ]
4144 else :
4245 # The fqdn is not none so we need to add the mongodb+srv:// prefix to the host.
@@ -46,11 +49,14 @@ def parse(uri):
4649 "ENGINE" : "django_mongodb" ,
4750 "NAME" : uri ["database" ],
4851 "HOST" : host ,
49- "PORT" : port ,
50- "USERNAME" : uri .get ("username" ),
52+ "USER" : uri .get ("username" ),
5153 "PASSWORD" : uri .get ("password" ),
5254 }
53- return (url )
55+
56+ if port :
57+ url ["PORT" ] = port
58+
59+ return url
5460
5561
5662def set_wrapped_methods (cls ):
You can’t perform that action at this time.
0 commit comments