File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -39,13 +39,10 @@ def parseresult_to_dict(parsed, unquote_password=False):
39
39
40
40
# urlparse in python 2.6 is broken so query will be empty and instead
41
41
# appended to path complete with '?'
42
- path_parts = parsed .path [1 :].split ('?' )
43
- try :
44
- query = path_parts [1 ]
45
- except IndexError :
46
- query = parsed .query
42
+ path = parsed .path [1 :] # Ignore leading '/'.
43
+ query = parsed .query
47
44
48
- connect_kwargs = {'database' : path_parts [ 0 ] }
45
+ connect_kwargs = {'database' : path }
49
46
if parsed .username :
50
47
connect_kwargs ['user' ] = parsed .username
51
48
if parsed .password :
Original file line number Diff line number Diff line change @@ -65,6 +65,12 @@ def test_db_url(self):
65
65
self .assertTrue (isinstance (db , SqliteDatabase ))
66
66
self .assertEqual (db .database , ':memory:' )
67
67
68
+ db = connect ('sqlite:///test.db?p1=1?a&p2=22&p3=xyz' )
69
+ self .assertTrue (isinstance (db , SqliteDatabase ))
70
+ self .assertEqual (db .database , 'test.db' )
71
+ self .assertEqual (db .connect_params , {
72
+ 'p1' : '1?a' , 'p2' : 22 , 'p3' : 'xyz' })
73
+
68
74
def test_bad_scheme (self ):
69
75
def _test_scheme ():
70
76
connect ('missing:///' )
You can’t perform that action at this time.
0 commit comments