From a5a4aaa624267aa26199f30e56c75f845001e3c1 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 2 Feb 2016 17:08:10 -0500 Subject: [PATCH] Revert "Merge pull request #59 from eisensheng/master" This reverts commit e13cc5ff96adad29a478ba3d04a5ad8b766fa40b, reversing changes made to 063ff555dd192b9bfc65d2bc4894894107059eb4. --- dj_database_url.py | 18 ++---------------- test_dj_database_url.py | 11 ----------- tox.ini | 6 ------ 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 tox.ini diff --git a/dj_database_url.py b/dj_database_url.py index a3defda..37975fc 100644 --- a/dj_database_url.py +++ b/dj_database_url.py @@ -66,13 +66,9 @@ def parse(url, engine=None, conn_max_age=0): url = urlparse.urlparse(url) - # Split query strings from path. + # Remove query strings. path = url.path[1:] - if '?' in path and not url.query: - path, query = path.split('?', 2) - else: - path, query = path, url.query - query = urlparse.parse_qs(query) + path = path.split('?', 2)[0] # If we are using sqlite and we have no path, then assume we # want an in-memory database (this is the behaviour of sqlalchemy) @@ -99,14 +95,4 @@ def parse(url, engine=None, conn_max_age=0): elif url.scheme in SCHEMES: config['ENGINE'] = SCHEMES[url.scheme] - if config['ENGINE'] == 'django.db.backends.postgresql_psycopg2': - try: - current_schema = query['currentSchema'][0] - except (KeyError, IndexError): - pass - else: - config['OPTIONS'] = { - 'options': '-c search_path=' + current_schema - } - return config diff --git a/test_dj_database_url.py b/test_dj_database_url.py index f20d3a3..d4c6c44 100644 --- a/test_dj_database_url.py +++ b/test_dj_database_url.py @@ -34,17 +34,6 @@ class DatabaseTestSuite(unittest.TestCase): assert url['PASSWORD'] == '' assert url['PORT'] == '' - def test_postgres_search_path_parsing(self): - url = 'postgres://uf07k1i6d8ia0v:wegauwhgeuioweg@ec2-107-21-253-135.compute-1.amazonaws.com:5431/d8r82722r2kuvn?currentSchema=otherschema' - url = dj_database_url.parse(url) - assert url['ENGINE'] == 'django.db.backends.postgresql_psycopg2' - assert url['NAME'] == 'd8r82722r2kuvn' - assert url['HOST'] == 'ec2-107-21-253-135.compute-1.amazonaws.com' - assert url['USER'] == 'uf07k1i6d8ia0v' - assert url['PASSWORD'] == 'wegauwhgeuioweg' - assert url['PORT'] == 5431 - assert url['OPTIONS'] == {'options': '-c search_path=otherschema'} - def test_postgis_parsing(self): url = 'postgis://uf07k1i6d8ia0v:wegauwhgeuioweg@ec2-107-21-253-135.compute-1.amazonaws.com:5431/d8r82722r2kuvn' url = dj_database_url.parse(url) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index bfbad6a..0000000 --- a/tox.ini +++ /dev/null @@ -1,6 +0,0 @@ -[tox] -envlist = py{26,27,32,33,34} - - -[testenv] -commands = python test_dj_database_url.py