From 01e35141479b8dfc4a390518f89fc52e7cec5396 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 11 May 2017 11:55:22 +0200 Subject: [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. --- odoo/sql_db.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'odoo/sql_db.py') 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: -- cgit v1.2.3