diff --git a/rhodecode/apps/admin/tests/test_admin_audit_logs.py b/rhodecode/apps/admin/tests/test_admin_audit_logs.py --- a/rhodecode/apps/admin/tests/test_admin_audit_logs.py +++ b/rhodecode/apps/admin/tests/test_admin_audit_logs.py @@ -32,7 +32,7 @@ from rhodecode.lib.utils2 import safe_un def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -42,7 +42,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/tests/test_admin_defaults.py b/rhodecode/apps/admin/tests/test_admin_defaults.py --- a/rhodecode/apps/admin/tests/test_admin_defaults.py +++ b/rhodecode/apps/admin/tests/test_admin_defaults.py @@ -25,7 +25,7 @@ from rhodecode.model.settings import Set def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -36,7 +36,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/tests/test_admin_main_views.py b/rhodecode/apps/admin/tests/test_admin_main_views.py --- a/rhodecode/apps/admin/tests/test_admin_main_views.py +++ b/rhodecode/apps/admin/tests/test_admin_main_views.py @@ -27,7 +27,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -40,7 +40,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/tests/test_admin_permissions.py b/rhodecode/apps/admin/tests/test_admin_permissions.py --- a/rhodecode/apps/admin/tests/test_admin_permissions.py +++ b/rhodecode/apps/admin/tests/test_admin_permissions.py @@ -29,7 +29,7 @@ from rhodecode.tests import ( def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -70,7 +70,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/tests/test_admin_repos.py b/rhodecode/apps/admin/tests/test_admin_repos.py --- a/rhodecode/apps/admin/tests/test_admin_repos.py +++ b/rhodecode/apps/admin/tests/test_admin_repos.py @@ -18,7 +18,7 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ -import urllib +import urllib.request, urllib.parse, urllib.error import mock import pytest @@ -43,7 +43,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'repos': ADMIN_PREFIX + '/repos', @@ -55,7 +55,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url @@ -494,7 +494,7 @@ class TestAdminRepos(object): assert response.json == {u'result': True} flash_msg = u'Created repository {}'.format( - urllib.quote(repo_name_utf8), repo_name) + urllib.parse.quote(repo_name_utf8), repo_name) assert_session_flash(response, flash_msg) # test if the repo was created in the database diff --git a/rhodecode/apps/admin/tests/test_admin_repository_groups.py b/rhodecode/apps/admin/tests/test_admin_repository_groups.py --- a/rhodecode/apps/admin/tests/test_admin_repository_groups.py +++ b/rhodecode/apps/admin/tests/test_admin_repository_groups.py @@ -34,7 +34,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'repo_groups': ADMIN_PREFIX + '/repo_groups', @@ -45,7 +45,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/tests/test_admin_settings.py b/rhodecode/apps/admin/tests/test_admin_settings.py --- a/rhodecode/apps/admin/tests/test_admin_settings.py +++ b/rhodecode/apps/admin/tests/test_admin_settings.py @@ -35,7 +35,7 @@ UPDATE_DATA_QUALNAME = 'rhodecode.model. def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -102,7 +102,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/tests/test_admin_user_groups.py b/rhodecode/apps/admin/tests/test_admin_user_groups.py --- a/rhodecode/apps/admin/tests/test_admin_user_groups.py +++ b/rhodecode/apps/admin/tests/test_admin_user_groups.py @@ -31,7 +31,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -44,7 +44,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/tests/test_admin_users.py b/rhodecode/apps/admin/tests/test_admin_users.py --- a/rhodecode/apps/admin/tests/test_admin_users.py +++ b/rhodecode/apps/admin/tests/test_admin_users.py @@ -35,7 +35,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -97,7 +97,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/tests/test_admin_users_ssh_keys.py b/rhodecode/apps/admin/tests/test_admin_users_ssh_keys.py --- a/rhodecode/apps/admin/tests/test_admin_users_ssh_keys.py +++ b/rhodecode/apps/admin/tests/test_admin_users_ssh_keys.py @@ -29,7 +29,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -45,7 +45,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/admin/views/system_info.py b/rhodecode/apps/admin/views/system_info.py --- a/rhodecode/apps/admin/views/system_info.py +++ b/rhodecode/apps/admin/views/system_info.py @@ -19,7 +19,7 @@ # and proprietary license terms, please see https://rhodecode.com/licenses/ import logging -import urllib2 +import urllib.request, urllib.error, urllib.parse import os import rhodecode @@ -209,7 +209,7 @@ class AdminSystemInfoSettingsView(BaseAp _err = lambda s: '
{}
'.format(s) try: data = UpdateModel().get_update_data(update_url) - except urllib2.URLError as e: + except urllib.error.URLError as e: log.exception("Exception contacting upgrade server") self.request.override_renderer = 'string' return _err('Failed to contact upgrade server: %r' % e) diff --git a/rhodecode/apps/file_store/tests/test_upload_file.py b/rhodecode/apps/file_store/tests/test_upload_file.py --- a/rhodecode/apps/file_store/tests/test_upload_file.py +++ b/rhodecode/apps/file_store/tests/test_upload_file.py @@ -28,7 +28,7 @@ from rhodecode.apps.file_store import ut def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'upload_file': '/_file_store/upload', @@ -38,7 +38,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/gist/tests/test_admin_gists.py b/rhodecode/apps/gist/tests/test_admin_gists.py --- a/rhodecode/apps/gist/tests/test_admin_gists.py +++ b/rhodecode/apps/gist/tests/test_admin_gists.py @@ -31,7 +31,7 @@ from rhodecode.tests import ( def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -50,7 +50,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/home/tests/test_get_goto_switched_data.py b/rhodecode/apps/home/tests/test_get_goto_switched_data.py --- a/rhodecode/apps/home/tests/test_get_goto_switched_data.py +++ b/rhodecode/apps/home/tests/test_get_goto_switched_data.py @@ -35,14 +35,14 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'goto_switcher_data': '/_goto_data', }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/home/tests/test_get_repo_list_data.py b/rhodecode/apps/home/tests/test_get_repo_list_data.py --- a/rhodecode/apps/home/tests/test_get_repo_list_data.py +++ b/rhodecode/apps/home/tests/test_get_repo_list_data.py @@ -29,14 +29,14 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'repo_list_data': '/_repos', }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/home/tests/test_get_user_data.py b/rhodecode/apps/home/tests/test_get_user_data.py --- a/rhodecode/apps/home/tests/test_get_user_data.py +++ b/rhodecode/apps/home/tests/test_get_user_data.py @@ -29,7 +29,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'user_autocomplete_data': '/_users', @@ -37,7 +37,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/home/tests/test_get_user_group_data.py b/rhodecode/apps/home/tests/test_get_user_group_data.py --- a/rhodecode/apps/home/tests/test_get_user_group_data.py +++ b/rhodecode/apps/home/tests/test_get_user_group_data.py @@ -49,7 +49,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'user_autocomplete_data': '/_users', @@ -57,7 +57,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/journal/tests/test_journal.py b/rhodecode/apps/journal/tests/test_journal.py --- a/rhodecode/apps/journal/tests/test_journal.py +++ b/rhodecode/apps/journal/tests/test_journal.py @@ -28,7 +28,7 @@ from rhodecode.model.db import UserFollo def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'journal': ADMIN_PREFIX + '/journal', @@ -43,7 +43,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/login/tests/test_login.py b/rhodecode/apps/login/tests/test_login.py --- a/rhodecode/apps/login/tests/test_login.py +++ b/rhodecode/apps/login/tests/test_login.py @@ -39,7 +39,7 @@ whitelist_view = ['RepoCommitsView:repo_ def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -61,7 +61,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/login/tests/test_password_reset.py b/rhodecode/apps/login/tests/test_password_reset.py --- a/rhodecode/apps/login/tests/test_password_reset.py +++ b/rhodecode/apps/login/tests/test_password_reset.py @@ -31,7 +31,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -50,7 +50,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/my_account/tests/test_my_account_edit.py b/rhodecode/apps/my_account/tests/test_my_account_edit.py --- a/rhodecode/apps/my_account/tests/test_my_account_edit.py +++ b/rhodecode/apps/my_account/tests/test_my_account_edit.py @@ -45,7 +45,7 @@ from rhodecode.lib import helpers as h def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -56,7 +56,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/my_account/tests/test_my_account_notifications.py b/rhodecode/apps/my_account/tests/test_my_account_notifications.py --- a/rhodecode/apps/my_account/tests/test_my_account_notifications.py +++ b/rhodecode/apps/my_account/tests/test_my_account_notifications.py @@ -35,7 +35,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -48,7 +48,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/my_account/tests/test_my_account_ssh_keys.py b/rhodecode/apps/my_account/tests/test_my_account_ssh_keys.py --- a/rhodecode/apps/my_account/tests/test_my_account_ssh_keys.py +++ b/rhodecode/apps/my_account/tests/test_my_account_ssh_keys.py @@ -29,7 +29,7 @@ fixture = Fixture() def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error from rhodecode.apps._base import ADMIN_PREFIX base_url = { @@ -44,7 +44,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/repo_group/tests/test_repo_groups_advanced.py b/rhodecode/apps/repo_group/tests/test_repo_groups_advanced.py --- a/rhodecode/apps/repo_group/tests/test_repo_groups_advanced.py +++ b/rhodecode/apps/repo_group/tests/test_repo_groups_advanced.py @@ -24,7 +24,7 @@ from rhodecode.tests import assert_sessi def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'edit_repo_group_advanced': @@ -34,7 +34,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/repo_group/tests/test_repo_groups_permissions.py b/rhodecode/apps/repo_group/tests/test_repo_groups_permissions.py --- a/rhodecode/apps/repo_group/tests/test_repo_groups_permissions.py +++ b/rhodecode/apps/repo_group/tests/test_repo_groups_permissions.py @@ -24,7 +24,7 @@ from rhodecode.tests.utils import permis def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'edit_repo_group_perms': @@ -34,7 +34,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/repo_group/tests/test_repo_groups_settings.py b/rhodecode/apps/repo_group/tests/test_repo_groups_settings.py --- a/rhodecode/apps/repo_group/tests/test_repo_groups_settings.py +++ b/rhodecode/apps/repo_group/tests/test_repo_groups_settings.py @@ -24,7 +24,7 @@ from rhodecode.tests import assert_sessi def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'edit_repo_group': '/{repo_group_name}/_edit', @@ -32,7 +32,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/repository/tests/test_pull_requests_list.py b/rhodecode/apps/repository/tests/test_pull_requests_list.py --- a/rhodecode/apps/repository/tests/test_pull_requests_list.py +++ b/rhodecode/apps/repository/tests/test_pull_requests_list.py @@ -23,7 +23,7 @@ from rhodecode.model.db import Repositor def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'pullrequest_show_all': '/{repo_name}/pull-request', @@ -31,7 +31,7 @@ def route_path(name, params=None, **kwar }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/repository/tests/test_repo_bookmarks.py b/rhodecode/apps/repository/tests/test_repo_bookmarks.py --- a/rhodecode/apps/repository/tests/test_repo_bookmarks.py +++ b/rhodecode/apps/repository/tests/test_repo_bookmarks.py @@ -23,14 +23,14 @@ from rhodecode.model.db import Repositor def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'bookmarks_home': '/{repo_name}/bookmarks', }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/repository/tests/test_repo_branches.py b/rhodecode/apps/repository/tests/test_repo_branches.py --- a/rhodecode/apps/repository/tests/test_repo_branches.py +++ b/rhodecode/apps/repository/tests/test_repo_branches.py @@ -23,14 +23,14 @@ from rhodecode.model.db import Repositor def route_path(name, params=None, **kwargs): - import urllib + import urllib.request, urllib.parse, urllib.error base_url = { 'branches_home': '/{repo_name}/branches', }[name].format(**kwargs) if params: - base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params)) return base_url diff --git a/rhodecode/apps/repository/tests/test_repo_changelog.py b/rhodecode/apps/repository/tests/test_repo_changelog.py --- a/rhodecode/apps/repository/tests/test_repo_changelog.py +++ b/rhodecode/apps/repository/tests/test_repo_changelog.py @@ -29,7 +29,7 @@ MATCH_HASH = re.compile(r'