summaryrefslogtreecommitdiff
path: root/odoo/sql_db.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2017-05-11 11:55:22 +0200
committerXavier Morel <xmo@odoo.com>2017-05-15 12:26:30 +0200
commit01e35141479b8dfc4a390518f89fc52e7cec5396 (patch)
tree24ac6661613e8088140eb607e604d44b2ff5ce42 /odoo/sql_db.py
parent54df4b36d7c826de3d07f81297aa17f74d8271ea (diff)
[FIX] P3: urllib, urllib2 and urlparse
In Python 3, all of these were "consolidated" under urllib(.request, .parse, .errors) which is inconvenient. Since we already have hard dependencies on requests and werkzeug(.urls, which is a backport of Python 3's unicode-aware urllib.parse) migrate *everything* to that. A sticking point is urllib2.URLError, those were (mostly) replaced by the slightly more general IOError which URLError extends.
Diffstat (limited to 'odoo/sql_db.py')
-rw-r--r--odoo/sql_db.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/odoo/sql_db.py b/odoo/sql_db.py
index a722c3ea41b..ee91704bb72 100644
--- a/odoo/sql_db.py
+++ b/odoo/sql_db.py
@@ -13,17 +13,13 @@ from functools import wraps
import logging
import time
import uuid
-try:
- from urllib import parse as urlparse
-except ImportError:
- #pylint: disable=bad-python3-import
- import urlparse
import psycopg2
import psycopg2.extras
import psycopg2.extensions
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED, ISOLATION_LEVEL_REPEATABLE_READ
from psycopg2.pool import PoolError
+from werkzeug import urls
from .tools import pycompat
@@ -656,7 +652,7 @@ def connection_info_for(db_or_uri):
"""
if db_or_uri.startswith(('postgresql://', 'postgres://')):
# extract db from uri
- us = urlparse.urlsplit(db_or_uri)
+ us = urls.url_parse(db_or_uri)
if len(us.path) > 1:
db_name = us.path[1:]
elif us.username: