##// END OF EJS Templates
python3: fix urllib usage
super-admin -
r4914:49ad81de default
parent child Browse files
Show More
@@ -32,7 +32,7 b' from rhodecode.lib.utils2 import safe_un'
32 32
33 33
34 34 def route_path(name, params=None, **kwargs):
35 import urllib
35 import urllib.request, urllib.parse, urllib.error
36 36 from rhodecode.apps._base import ADMIN_PREFIX
37 37
38 38 base_url = {
@@ -42,7 +42,7 b' def route_path(name, params=None, **kwar'
42 42 }[name].format(**kwargs)
43 43
44 44 if params:
45 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
45 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
46 46 return base_url
47 47
48 48
@@ -25,7 +25,7 b' from rhodecode.model.settings import Set'
25 25
26 26
27 27 def route_path(name, params=None, **kwargs):
28 import urllib
28 import urllib.request, urllib.parse, urllib.error
29 29 from rhodecode.apps._base import ADMIN_PREFIX
30 30
31 31 base_url = {
@@ -36,7 +36,7 b' def route_path(name, params=None, **kwar'
36 36 }[name].format(**kwargs)
37 37
38 38 if params:
39 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
39 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
40 40 return base_url
41 41
42 42
@@ -27,7 +27,7 b' fixture = Fixture()'
27 27
28 28
29 29 def route_path(name, params=None, **kwargs):
30 import urllib
30 import urllib.request, urllib.parse, urllib.error
31 31 from rhodecode.apps._base import ADMIN_PREFIX
32 32
33 33 base_url = {
@@ -40,7 +40,7 b' def route_path(name, params=None, **kwar'
40 40 }[name].format(**kwargs)
41 41
42 42 if params:
43 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
43 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
44 44 return base_url
45 45
46 46
@@ -29,7 +29,7 b' from rhodecode.tests import ('
29 29
30 30
31 31 def route_path(name, params=None, **kwargs):
32 import urllib
32 import urllib.request, urllib.parse, urllib.error
33 33 from rhodecode.apps._base import ADMIN_PREFIX
34 34
35 35 base_url = {
@@ -70,7 +70,7 b' def route_path(name, params=None, **kwar'
70 70 }[name].format(**kwargs)
71 71
72 72 if params:
73 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
73 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
74 74 return base_url
75 75
76 76
@@ -18,7 +18,7 b''
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 import urllib
21 import urllib.request, urllib.parse, urllib.error
22 22
23 23 import mock
24 24 import pytest
@@ -43,7 +43,7 b' fixture = Fixture()'
43 43
44 44
45 45 def route_path(name, params=None, **kwargs):
46 import urllib
46 import urllib.request, urllib.parse, urllib.error
47 47
48 48 base_url = {
49 49 'repos': ADMIN_PREFIX + '/repos',
@@ -55,7 +55,7 b' def route_path(name, params=None, **kwar'
55 55 }[name].format(**kwargs)
56 56
57 57 if params:
58 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
58 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
59 59 return base_url
60 60
61 61
@@ -494,7 +494,7 b' class TestAdminRepos(object):'
494 494 assert response.json == {u'result': True}
495 495
496 496 flash_msg = u'Created repository <a href="/{}">{}</a>'.format(
497 urllib.quote(repo_name_utf8), repo_name)
497 urllib.parse.quote(repo_name_utf8), repo_name)
498 498 assert_session_flash(response, flash_msg)
499 499
500 500 # test if the repo was created in the database
@@ -34,7 +34,7 b' fixture = Fixture()'
34 34
35 35
36 36 def route_path(name, params=None, **kwargs):
37 import urllib
37 import urllib.request, urllib.parse, urllib.error
38 38
39 39 base_url = {
40 40 'repo_groups': ADMIN_PREFIX + '/repo_groups',
@@ -45,7 +45,7 b' def route_path(name, params=None, **kwar'
45 45 }[name].format(**kwargs)
46 46
47 47 if params:
48 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
48 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
49 49 return base_url
50 50
51 51
@@ -35,7 +35,7 b" UPDATE_DATA_QUALNAME = 'rhodecode.model."
35 35
36 36
37 37 def route_path(name, params=None, **kwargs):
38 import urllib
38 import urllib.request, urllib.parse, urllib.error
39 39 from rhodecode.apps._base import ADMIN_PREFIX
40 40
41 41 base_url = {
@@ -102,7 +102,7 b' def route_path(name, params=None, **kwar'
102 102 }[name].format(**kwargs)
103 103
104 104 if params:
105 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
105 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
106 106 return base_url
107 107
108 108
@@ -31,7 +31,7 b' fixture = Fixture()'
31 31
32 32
33 33 def route_path(name, params=None, **kwargs):
34 import urllib
34 import urllib.request, urllib.parse, urllib.error
35 35 from rhodecode.apps._base import ADMIN_PREFIX
36 36
37 37 base_url = {
@@ -44,7 +44,7 b' def route_path(name, params=None, **kwar'
44 44 }[name].format(**kwargs)
45 45
46 46 if params:
47 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
47 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
48 48 return base_url
49 49
50 50
@@ -35,7 +35,7 b' fixture = Fixture()'
35 35
36 36
37 37 def route_path(name, params=None, **kwargs):
38 import urllib
38 import urllib.request, urllib.parse, urllib.error
39 39 from rhodecode.apps._base import ADMIN_PREFIX
40 40
41 41 base_url = {
@@ -97,7 +97,7 b' def route_path(name, params=None, **kwar'
97 97 }[name].format(**kwargs)
98 98
99 99 if params:
100 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
100 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
101 101 return base_url
102 102
103 103
@@ -29,7 +29,7 b' fixture = Fixture()'
29 29
30 30
31 31 def route_path(name, params=None, **kwargs):
32 import urllib
32 import urllib.request, urllib.parse, urllib.error
33 33 from rhodecode.apps._base import ADMIN_PREFIX
34 34
35 35 base_url = {
@@ -45,7 +45,7 b' def route_path(name, params=None, **kwar'
45 45 }[name].format(**kwargs)
46 46
47 47 if params:
48 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
48 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
49 49 return base_url
50 50
51 51
@@ -19,7 +19,7 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import logging
22 import urllib2
22 import urllib.request, urllib.error, urllib.parse
23 23 import os
24 24
25 25 import rhodecode
@@ -209,7 +209,7 b' class AdminSystemInfoSettingsView(BaseAp'
209 209 _err = lambda s: '<div style="color:#ff8888; padding:4px 0px">{}</div>'.format(s)
210 210 try:
211 211 data = UpdateModel().get_update_data(update_url)
212 except urllib2.URLError as e:
212 except urllib.error.URLError as e:
213 213 log.exception("Exception contacting upgrade server")
214 214 self.request.override_renderer = 'string'
215 215 return _err('Failed to contact upgrade server: %r' % e)
@@ -28,7 +28,7 b' from rhodecode.apps.file_store import ut'
28 28
29 29
30 30 def route_path(name, params=None, **kwargs):
31 import urllib
31 import urllib.request, urllib.parse, urllib.error
32 32
33 33 base_url = {
34 34 'upload_file': '/_file_store/upload',
@@ -38,7 +38,7 b' def route_path(name, params=None, **kwar'
38 38 }[name].format(**kwargs)
39 39
40 40 if params:
41 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
41 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
42 42 return base_url
43 43
44 44
@@ -31,7 +31,7 b' from rhodecode.tests import ('
31 31
32 32
33 33 def route_path(name, params=None, **kwargs):
34 import urllib
34 import urllib.request, urllib.parse, urllib.error
35 35 from rhodecode.apps._base import ADMIN_PREFIX
36 36
37 37 base_url = {
@@ -50,7 +50,7 b' def route_path(name, params=None, **kwar'
50 50 }[name].format(**kwargs)
51 51
52 52 if params:
53 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
53 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
54 54 return base_url
55 55
56 56
@@ -35,14 +35,14 b' fixture = Fixture()'
35 35
36 36
37 37 def route_path(name, params=None, **kwargs):
38 import urllib
38 import urllib.request, urllib.parse, urllib.error
39 39
40 40 base_url = {
41 41 'goto_switcher_data': '/_goto_data',
42 42 }[name].format(**kwargs)
43 43
44 44 if params:
45 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
45 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
46 46 return base_url
47 47
48 48
@@ -29,14 +29,14 b' fixture = Fixture()'
29 29
30 30
31 31 def route_path(name, params=None, **kwargs):
32 import urllib
32 import urllib.request, urllib.parse, urllib.error
33 33
34 34 base_url = {
35 35 'repo_list_data': '/_repos',
36 36 }[name].format(**kwargs)
37 37
38 38 if params:
39 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
39 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
40 40 return base_url
41 41
42 42
@@ -29,7 +29,7 b' fixture = Fixture()'
29 29
30 30
31 31 def route_path(name, params=None, **kwargs):
32 import urllib
32 import urllib.request, urllib.parse, urllib.error
33 33
34 34 base_url = {
35 35 'user_autocomplete_data': '/_users',
@@ -37,7 +37,7 b' def route_path(name, params=None, **kwar'
37 37 }[name].format(**kwargs)
38 38
39 39 if params:
40 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
40 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
41 41 return base_url
42 42
43 43
@@ -49,7 +49,7 b' fixture = Fixture()'
49 49
50 50
51 51 def route_path(name, params=None, **kwargs):
52 import urllib
52 import urllib.request, urllib.parse, urllib.error
53 53
54 54 base_url = {
55 55 'user_autocomplete_data': '/_users',
@@ -57,7 +57,7 b' def route_path(name, params=None, **kwar'
57 57 }[name].format(**kwargs)
58 58
59 59 if params:
60 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
60 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
61 61 return base_url
62 62
63 63
@@ -28,7 +28,7 b' from rhodecode.model.db import UserFollo'
28 28
29 29
30 30 def route_path(name, params=None, **kwargs):
31 import urllib
31 import urllib.request, urllib.parse, urllib.error
32 32
33 33 base_url = {
34 34 'journal': ADMIN_PREFIX + '/journal',
@@ -43,7 +43,7 b' def route_path(name, params=None, **kwar'
43 43 }[name].format(**kwargs)
44 44
45 45 if params:
46 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
46 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
47 47 return base_url
48 48
49 49
@@ -39,7 +39,7 b" whitelist_view = ['RepoCommitsView:repo_"
39 39
40 40
41 41 def route_path(name, params=None, **kwargs):
42 import urllib
42 import urllib.request, urllib.parse, urllib.error
43 43 from rhodecode.apps._base import ADMIN_PREFIX
44 44
45 45 base_url = {
@@ -61,7 +61,7 b' def route_path(name, params=None, **kwar'
61 61 }[name].format(**kwargs)
62 62
63 63 if params:
64 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
64 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
65 65 return base_url
66 66
67 67
@@ -31,7 +31,7 b' fixture = Fixture()'
31 31
32 32
33 33 def route_path(name, params=None, **kwargs):
34 import urllib
34 import urllib.request, urllib.parse, urllib.error
35 35 from rhodecode.apps._base import ADMIN_PREFIX
36 36
37 37 base_url = {
@@ -50,7 +50,7 b' def route_path(name, params=None, **kwar'
50 50 }[name].format(**kwargs)
51 51
52 52 if params:
53 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
53 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
54 54 return base_url
55 55
56 56
@@ -45,7 +45,7 b' from rhodecode.lib import helpers as h'
45 45
46 46
47 47 def route_path(name, params=None, **kwargs):
48 import urllib
48 import urllib.request, urllib.parse, urllib.error
49 49 from rhodecode.apps._base import ADMIN_PREFIX
50 50
51 51 base_url = {
@@ -56,7 +56,7 b' def route_path(name, params=None, **kwar'
56 56 }[name].format(**kwargs)
57 57
58 58 if params:
59 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
59 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
60 60 return base_url
61 61
62 62
@@ -35,7 +35,7 b' fixture = Fixture()'
35 35
36 36
37 37 def route_path(name, params=None, **kwargs):
38 import urllib
38 import urllib.request, urllib.parse, urllib.error
39 39 from rhodecode.apps._base import ADMIN_PREFIX
40 40
41 41 base_url = {
@@ -48,7 +48,7 b' def route_path(name, params=None, **kwar'
48 48 }[name].format(**kwargs)
49 49
50 50 if params:
51 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
51 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
52 52 return base_url
53 53
54 54
@@ -29,7 +29,7 b' fixture = Fixture()'
29 29
30 30
31 31 def route_path(name, params=None, **kwargs):
32 import urllib
32 import urllib.request, urllib.parse, urllib.error
33 33 from rhodecode.apps._base import ADMIN_PREFIX
34 34
35 35 base_url = {
@@ -44,7 +44,7 b' def route_path(name, params=None, **kwar'
44 44 }[name].format(**kwargs)
45 45
46 46 if params:
47 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
47 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
48 48 return base_url
49 49
50 50
@@ -24,7 +24,7 b' from rhodecode.tests import assert_sessi'
24 24
25 25
26 26 def route_path(name, params=None, **kwargs):
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28
29 29 base_url = {
30 30 'edit_repo_group_advanced':
@@ -34,7 +34,7 b' def route_path(name, params=None, **kwar'
34 34 }[name].format(**kwargs)
35 35
36 36 if params:
37 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
37 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
38 38 return base_url
39 39
40 40
@@ -24,7 +24,7 b' from rhodecode.tests.utils import permis'
24 24
25 25
26 26 def route_path(name, params=None, **kwargs):
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28
29 29 base_url = {
30 30 'edit_repo_group_perms':
@@ -34,7 +34,7 b' def route_path(name, params=None, **kwar'
34 34 }[name].format(**kwargs)
35 35
36 36 if params:
37 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
37 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
38 38 return base_url
39 39
40 40
@@ -24,7 +24,7 b' from rhodecode.tests import assert_sessi'
24 24
25 25
26 26 def route_path(name, params=None, **kwargs):
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28
29 29 base_url = {
30 30 'edit_repo_group': '/{repo_group_name}/_edit',
@@ -32,7 +32,7 b' def route_path(name, params=None, **kwar'
32 32 }[name].format(**kwargs)
33 33
34 34 if params:
35 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
35 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
36 36 return base_url
37 37
38 38
@@ -23,7 +23,7 b' from rhodecode.model.db import Repositor'
23 23
24 24
25 25 def route_path(name, params=None, **kwargs):
26 import urllib
26 import urllib.request, urllib.parse, urllib.error
27 27
28 28 base_url = {
29 29 'pullrequest_show_all': '/{repo_name}/pull-request',
@@ -31,7 +31,7 b' def route_path(name, params=None, **kwar'
31 31 }[name].format(**kwargs)
32 32
33 33 if params:
34 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
34 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
35 35 return base_url
36 36
37 37
@@ -23,14 +23,14 b' from rhodecode.model.db import Repositor'
23 23
24 24
25 25 def route_path(name, params=None, **kwargs):
26 import urllib
26 import urllib.request, urllib.parse, urllib.error
27 27
28 28 base_url = {
29 29 'bookmarks_home': '/{repo_name}/bookmarks',
30 30 }[name].format(**kwargs)
31 31
32 32 if params:
33 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
33 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
34 34 return base_url
35 35
36 36
@@ -23,14 +23,14 b' from rhodecode.model.db import Repositor'
23 23
24 24
25 25 def route_path(name, params=None, **kwargs):
26 import urllib
26 import urllib.request, urllib.parse, urllib.error
27 27
28 28 base_url = {
29 29 'branches_home': '/{repo_name}/branches',
30 30 }[name].format(**kwargs)
31 31
32 32 if params:
33 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
33 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
34 34 return base_url
35 35
36 36
@@ -29,7 +29,7 b' MATCH_HASH = re.compile(r\'<span class="c'
29 29
30 30
31 31 def route_path(name, params=None, **kwargs):
32 import urllib
32 import urllib.request, urllib.parse, urllib.error
33 33
34 34 base_url = {
35 35 'repo_changelog': '/{repo_name}/changelog',
@@ -39,7 +39,7 b' def route_path(name, params=None, **kwar'
39 39 }[name].format(**kwargs)
40 40
41 41 if params:
42 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
42 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
43 43 return base_url
44 44
45 45
@@ -28,7 +28,7 b' from rhodecode.lib import helpers as h'
28 28
29 29
30 30 def route_path(name, params=None, **kwargs):
31 import urllib
31 import urllib.request, urllib.parse, urllib.error
32 32
33 33 base_url = {
34 34 'repo_commit': '/{repo_name}/changeset/{commit_id}',
@@ -39,7 +39,7 b' def route_path(name, params=None, **kwar'
39 39 }[name].format(**kwargs)
40 40
41 41 if params:
42 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
42 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
43 43 return base_url
44 44
45 45
@@ -25,7 +25,7 b' from rhodecode.lib.helpers import _short'
25 25
26 26
27 27 def route_path(name, params=None, **kwargs):
28 import urllib
28 import urllib.request, urllib.parse, urllib.error
29 29
30 30 base_url = {
31 31 'repo_commit': '/{repo_name}/changeset/{commit_id}',
@@ -39,7 +39,7 b' def route_path(name, params=None, **kwar'
39 39 }[name].format(**kwargs)
40 40
41 41 if params:
42 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
42 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
43 43 return base_url
44 44
45 45
@@ -28,7 +28,7 b' from rhodecode.tests.utils import Assert'
28 28
29 29
30 30 def route_path(name, params=None, **kwargs):
31 import urllib
31 import urllib.request, urllib.parse, urllib.error
32 32
33 33 base_url = {
34 34 'repo_compare_select': '/{repo_name}/compare',
@@ -36,7 +36,7 b' def route_path(name, params=None, **kwar'
36 36 }[name].format(**kwargs)
37 37
38 38 if params:
39 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
39 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
40 40 return base_url
41 41
42 42
@@ -24,7 +24,7 b' from .test_repo_compare import ComparePa'
24 24
25 25
26 26 def route_path(name, params=None, **kwargs):
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28
29 29 base_url = {
30 30 'repo_compare_select': '/{repo_name}/compare',
@@ -32,7 +32,7 b' def route_path(name, params=None, **kwar'
32 32 }[name].format(**kwargs)
33 33
34 34 if params:
35 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
35 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
36 36 return base_url
37 37
38 38
@@ -30,7 +30,7 b' fixture = Fixture()'
30 30
31 31
32 32 def route_path(name, params=None, **kwargs):
33 import urllib
33 import urllib.request, urllib.parse, urllib.error
34 34
35 35 base_url = {
36 36 'repo_compare_select': '/{repo_name}/compare',
@@ -38,7 +38,7 b' def route_path(name, params=None, **kwar'
38 38 }[name].format(**kwargs)
39 39
40 40 if params:
41 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
41 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
42 42 return base_url
43 43
44 44
@@ -24,7 +24,7 b' from rhodecode.tests import TestControll'
24 24
25 25
26 26 def route_path(name, params=None, **kwargs):
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28
29 29 base_url = {
30 30 'rss_feed_home': '/{repo_name}/feed-rss',
@@ -34,7 +34,7 b' def route_path(name, params=None, **kwar'
34 34 }[name].format(**kwargs)
35 35
36 36 if params:
37 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
37 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
38 38 return base_url
39 39
40 40
@@ -47,7 +47,7 b' def get_node_history(backend_type):'
47 47
48 48
49 49 def route_path(name, params=None, **kwargs):
50 import urllib
50 import urllib.request, urllib.parse, urllib.error
51 51
52 52 base_url = {
53 53 'repo_summary': '/{repo_name}',
@@ -76,7 +76,7 b' def route_path(name, params=None, **kwar'
76 76 }[name].format(**kwargs)
77 77
78 78 if params:
79 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
79 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
80 80 return base_url
81 81
82 82
@@ -34,7 +34,7 b' fixture = Fixture()'
34 34
35 35
36 36 def route_path(name, params=None, **kwargs):
37 import urllib
37 import urllib.request, urllib.parse, urllib.error
38 38
39 39 base_url = {
40 40 'repo_summary': '/{repo_name}',
@@ -46,7 +46,7 b' def route_path(name, params=None, **kwar'
46 46 }[name].format(**kwargs)
47 47
48 48 if params:
49 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
49 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
50 50 return base_url
51 51
52 52
@@ -27,7 +27,7 b' from rhodecode.model.settings import Set'
27 27
28 28
29 29 def route_path(name, params=None, **kwargs):
30 import urllib
30 import urllib.request, urllib.parse, urllib.error
31 31
32 32 base_url = {
33 33 'repo_summary': '/{repo_name}',
@@ -38,7 +38,7 b' def route_path(name, params=None, **kwar'
38 38 }[name].format(**kwargs)
39 39
40 40 if params:
41 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
41 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
42 42 return base_url
43 43
44 44
@@ -33,7 +33,7 b' fixture = Fixture()'
33 33
34 34
35 35 def route_path(name, params=None, **kwargs):
36 import urllib
36 import urllib.request, urllib.parse, urllib.error
37 37
38 38 base_url = {
39 39 'edit_repo_maintenance': '/{repo_name}/settings/maintenance',
@@ -42,7 +42,7 b' def route_path(name, params=None, **kwar'
42 42 }[name].format(**kwargs)
43 43
44 44 if params:
45 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
45 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
46 46 return base_url
47 47
48 48
@@ -24,7 +24,7 b' from rhodecode.tests.utils import permis'
24 24
25 25
26 26 def route_path(name, params=None, **kwargs):
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28
29 29 base_url = {
30 30 'edit_repo_perms': '/{repo_name}/settings/permissions'
@@ -32,7 +32,7 b' def route_path(name, params=None, **kwar'
32 32 }[name].format(**kwargs)
33 33
34 34 if params:
35 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
35 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
36 36 return base_url
37 37
38 38
@@ -37,7 +37,7 b' from rhodecode.tests import ('
37 37
38 38
39 39 def route_path(name, params=None, **kwargs):
40 import urllib
40 import urllib.request, urllib.parse, urllib.error
41 41
42 42 base_url = {
43 43 'repo_changelog': '/{repo_name}/changelog',
@@ -60,7 +60,7 b' def route_path(name, params=None, **kwar'
60 60 }[name].format(**kwargs)
61 61
62 62 if params:
63 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
63 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
64 64 return base_url
65 65
66 66
@@ -33,7 +33,7 b' fixture = Fixture()'
33 33
34 34
35 35 def route_path(name, params=None, **kwargs):
36 import urllib
36 import urllib.request, urllib.parse, urllib.error
37 37
38 38 base_url = {
39 39 'edit_repo': '/{repo_name}/settings',
@@ -48,7 +48,7 b' def route_path(name, params=None, **kwar'
48 48 }[name].format(**kwargs)
49 49
50 50 if params:
51 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
51 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
52 52 return base_url
53 53
54 54
@@ -32,7 +32,7 b' fixture = Fixture()'
32 32
33 33
34 34 def route_path(name, params=None, **kwargs):
35 import urllib
35 import urllib.request, urllib.parse, urllib.error
36 36
37 37 base_url = {
38 38 'repo_summary_explicit': '/{repo_name}/summary',
@@ -47,7 +47,7 b' def route_path(name, params=None, **kwar'
47 47 }[name].format(**kwargs)
48 48
49 49 if params:
50 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
50 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
51 51 return base_url
52 52
53 53
@@ -41,7 +41,7 b' fixture = Fixture()'
41 41
42 42
43 43 def route_path(name, params=None, **kwargs):
44 import urllib
44 import urllib.request, urllib.parse, urllib.error
45 45
46 46 base_url = {
47 47 'repo_summary': '/{repo_name}',
@@ -52,7 +52,7 b' def route_path(name, params=None, **kwar'
52 52 }[name].format(**kwargs)
53 53
54 54 if params:
55 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
55 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
56 56 return base_url
57 57
58 58
@@ -23,14 +23,14 b' from rhodecode.model.db import Repositor'
23 23
24 24
25 25 def route_path(name, params=None, **kwargs):
26 import urllib
26 import urllib.request, urllib.parse, urllib.error
27 27
28 28 base_url = {
29 29 'tags_home': '/{repo_name}/tags',
30 30 }[name].format(**kwargs)
31 31
32 32 if params:
33 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
33 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
34 34 return base_url
35 35
36 36
@@ -38,7 +38,7 b' fixture = Fixture()'
38 38
39 39
40 40 def route_path(name, params=None, **kwargs):
41 import urllib
41 import urllib.request, urllib.parse, urllib.error
42 42
43 43 base_url = {
44 44 'repo_summary': '/{repo_name}',
@@ -50,7 +50,7 b' def route_path(name, params=None, **kwar'
50 50 }[name].format(**kwargs)
51 51
52 52 if params:
53 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
53 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
54 54 return base_url
55 55
56 56
@@ -28,7 +28,7 b' from rhodecode.tests.utils import Assert'
28 28
29 29
30 30 def route_path(name, params=None, **kwargs):
31 import urllib
31 import urllib.request, urllib.parse, urllib.error
32 32
33 33 base_url = {
34 34 'edit_repo': '/{repo_name}/settings',
@@ -37,7 +37,7 b' def route_path(name, params=None, **kwar'
37 37 }[name].format(**kwargs)
38 38
39 39 if params:
40 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
40 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
41 41 return base_url
42 42
43 43
@@ -24,7 +24,7 b' import os'
24 24 import shutil
25 25 import tempfile
26 26 import collections
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28 import pathlib2
29 29
30 30 from pyramid.httpexceptions import HTTPNotFound, HTTPBadRequest, HTTPFound
@@ -804,7 +804,7 b' class RepoFilesView(RepoAppView):'
804 804 def _get_attachement_headers(self, f_path):
805 805 f_name = safe_str(f_path.split(Repository.NAME_SEP)[-1])
806 806 safe_path = f_name.replace('"', '\\"')
807 encoded_path = urllib.quote(f_name)
807 encoded_path = urllib.parse.quote(f_name)
808 808
809 809 return "attachment; " \
810 810 "filename=\"{}\"; " \
@@ -19,7 +19,7 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import logging
22 import urllib
22 import urllib.request, urllib.parse, urllib.error
23 23
24 24 from webhelpers2.html.tools import update_params
25 25
@@ -69,7 +69,7 b' def perform_search(request, tmpl_context'
69 69 'sort': search_sort
70 70 }
71 71
72 return '?' + urllib.urlencode(query_params)
72 return '?' + urllib.parse.urlencode(query_params)
73 73
74 74 c = tmpl_context
75 75 search_query = search_params.get('search_query')
@@ -30,7 +30,7 b' fixture = Fixture()'
30 30
31 31
32 32 def route_path(name, params=None, **kwargs):
33 import urllib
33 import urllib.request, urllib.parse, urllib.error
34 34 from rhodecode.apps._base import ADMIN_PREFIX
35 35
36 36 base_url = {
@@ -48,7 +48,7 b' def route_path(name, params=None, **kwar'
48 48 }[name].format(**kwargs)
49 49
50 50 if params:
51 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
51 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
52 52 return base_url
53 53
54 54
@@ -24,7 +24,7 b' from rhodecode.tests.utils import permis'
24 24
25 25
26 26 def route_path(name, params=None, **kwargs):
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28 from rhodecode.apps._base import ADMIN_PREFIX
29 29
30 30 base_url = {
@@ -35,7 +35,7 b' def route_path(name, params=None, **kwar'
35 35 }[name].format(**kwargs)
36 36
37 37 if params:
38 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
38 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
39 39 return base_url
40 40
41 41
@@ -26,7 +26,7 b' RhodeCode authentication plugin for Atla'
26 26 import colander
27 27 import base64
28 28 import logging
29 import urllib2
29 import urllib.request, urllib.error, urllib.parse
30 30
31 31 from rhodecode.translation import _
32 32 from rhodecode.authentication.base import (
@@ -128,10 +128,10 b' class CrowdServer(object):'
128 128 self._make_opener()
129 129
130 130 def _make_opener(self):
131 mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
131 mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
132 132 mgr.add_password(None, self._uri, self.user, self.passwd)
133 handler = urllib2.HTTPBasicAuthHandler(mgr)
134 self.opener = urllib2.build_opener(handler)
133 handler = urllib.request.HTTPBasicAuthHandler(mgr)
134 self.opener = urllib.request.build_opener(handler)
135 135
136 136 def _request(self, url, body=None, headers=None,
137 137 method=None, noformat=False,
@@ -146,7 +146,7 b' class CrowdServer(object):'
146 146 log.debug("Sent crowd: \n%s"
147 147 % (formatted_json({"url": url, "body": body,
148 148 "headers": _headers})))
149 request = urllib2.Request(url, body, _headers)
149 request = urllib.request.Request(url, body, _headers)
150 150 if method:
151 151 request.get_method = lambda: method
152 152
@@ -27,8 +27,8 b' http://www.jasig.org/cas'
27 27 import colander
28 28 import logging
29 29 import rhodecode
30 import urllib
31 import urllib2
30 import urllib.request, urllib.parse, urllib.error
31 import urllib.request, urllib.error, urllib.parse
32 32
33 33 from rhodecode.translation import _
34 34 from rhodecode.authentication.base import (
@@ -123,7 +123,7 b' class RhodeCodeAuthPlugin(RhodeCodeExter'
123 123 return None
124 124
125 125 log.debug("Jasig CAS settings: %s", settings)
126 params = urllib.urlencode({'username': username, 'password': password})
126 params = urllib.parse.urlencode({'username': username, 'password': password})
127 127 headers = {"Content-type": "application/x-www-form-urlencoded",
128 128 "Accept": "text/plain",
129 129 "User-Agent": "RhodeCode-auth-%s" % rhodecode.__version__}
@@ -131,13 +131,13 b' class RhodeCodeAuthPlugin(RhodeCodeExter'
131 131
132 132 log.debug("Sent Jasig CAS: \n%s",
133 133 {"url": url, "body": params, "headers": headers})
134 request = urllib2.Request(url, params, headers)
134 request = urllib.request.Request(url, params, headers)
135 135 try:
136 response = urllib2.urlopen(request)
137 except urllib2.HTTPError as e:
136 response = urllib.request.urlopen(request)
137 except urllib.error.HTTPError as e:
138 138 log.debug("HTTPError when requesting Jasig CAS (status code: %d)", e.code)
139 139 return None
140 except urllib2.URLError as e:
140 except urllib.error.URLError as e:
141 141 log.debug("URLError when requesting Jasig CAS url: %s ", url)
142 142 return None
143 143
@@ -21,7 +21,7 b' import os'
21 21 import string
22 22 import functools
23 23 import collections
24 import urllib
24 import urllib.request, urllib.parse, urllib.error
25 25
26 26 log = logging.getLogger('rhodecode.' + __name__)
27 27
@@ -195,5 +195,5 b' class UrlTemplate(string.Template):'
195 195
196 196 def safe_substitute(self, **kws):
197 197 # url encode the kw for usage in url
198 kws = {k: urllib.quote(str(v)) for k, v in kws.items()}
198 kws = {k: urllib.parse.quote(str(v)) for k, v in kws.items()}
199 199 return super(UrlTemplate, self).safe_substitute(**kws)
@@ -23,7 +23,7 b' import string'
23 23 import collections
24 24 import logging
25 25 import requests
26 import urllib
26 import urllib.request, urllib.parse, urllib.error
27 27 from requests.adapters import HTTPAdapter
28 28 from requests.packages.urllib3.util.retry import Retry
29 29
@@ -40,7 +40,7 b' class UrlTmpl(string.Template):'
40 40
41 41 def safe_substitute(self, **kws):
42 42 # url encode the kw for usage in url
43 kws = {k: urllib.quote(safe_str(v)) for k, v in kws.items()}
43 kws = {k: urllib.parse.quote(safe_str(v)) for k, v in kws.items()}
44 44 return super(UrlTmpl, self).safe_substitute(**kws)
45 45
46 46
@@ -31,7 +31,7 b' import math'
31 31 import re
32 32 import sys
33 33 import time
34 import urllib
34 import urllib.request, urllib.parse, urllib.error
35 35
36 36
37 37 class diff_match_patch:
@@ -1152,7 +1152,7 b' class diff_match_patch:'
1152 1152 if op == self.DIFF_INSERT:
1153 1153 # High ascii will raise UnicodeDecodeError. Use Unicode instead.
1154 1154 data = data.encode("utf-8")
1155 text.append("+" + urllib.quote(data, "!~*'();/?:@&=+$,# "))
1155 text.append("+" + urllib.parse.quote(data, "!~*'();/?:@&=+$,# "))
1156 1156 elif op == self.DIFF_DELETE:
1157 1157 text.append("-%d" % len(data))
1158 1158 elif op == self.DIFF_EQUAL:
@@ -1188,7 +1188,7 b' class diff_match_patch:'
1188 1188 # operation of this token (delete, insert, equality).
1189 1189 param = token[1:]
1190 1190 if token[0] == "+":
1191 param = urllib.unquote(param).decode("utf-8")
1191 param = urllib.parse.unquote(param).decode("utf-8")
1192 1192 diffs.append((self.DIFF_INSERT, param))
1193 1193 elif token[0] == "-" or token[0] == "=":
1194 1194 try:
@@ -1847,7 +1847,7 b' class diff_match_patch:'
1847 1847 sign = text[0][0]
1848 1848 else:
1849 1849 sign = ''
1850 line = urllib.unquote(text[0][1:])
1850 line = urllib.parse.unquote(text[0][1:])
1851 1851 line = line.decode("utf-8")
1852 1852 if sign == '+':
1853 1853 # Insertion.
@@ -1915,5 +1915,5 b' class patch_obj:'
1915 1915 text.append(" ")
1916 1916 # High ascii will raise UnicodeDecodeError. Use Unicode instead.
1917 1917 data = data.encode("utf-8")
1918 text.append(urllib.quote(data, "!~*'();/?:@&=+$,# ") + "\n")
1918 text.append(urllib.parse.quote(data, "!~*'();/?:@&=+$,# ") + "\n")
1919 1919 return "".join(text) No newline at end of file
@@ -5,7 +5,7 b' Utilities for XML generation/parsing.'
5 5 import six
6 6
7 7 from xml.sax.saxutils import XMLGenerator, quoteattr
8 from urllib import quote
8 from urllib.parse import quote
9 9 from rhodecode.lib.utils import safe_str, safe_unicode
10 10
11 11
@@ -32,7 +32,7 b' import random'
32 32 import hashlib
33 33 import StringIO
34 34 import textwrap
35 import urllib
35 import urllib.request, urllib.parse, urllib.error
36 36 import math
37 37 import logging
38 38 import re
@@ -336,13 +336,13 b' def files_breadcrumbs(repo_name, repo_ty'
336 336
337 337
338 338 def files_url_data(request):
339 import urllib
339 import urllib.request, urllib.parse, urllib.error
340 340 matchdict = request.matchdict
341 341
342 342 if 'f_path' not in matchdict:
343 343 matchdict['f_path'] = ''
344 344 else:
345 matchdict['f_path'] = urllib.quote(safe_str(matchdict['f_path']))
345 matchdict['f_path'] = urllib.parse.quote(safe_str(matchdict['f_path']))
346 346 if 'commit_id' not in matchdict:
347 347 matchdict['commit_id'] = 'tip'
348 348
@@ -25,7 +25,7 b' SimpleHG middleware for handling mercuri'
25 25
26 26 import logging
27 27 import urlparse
28 import urllib
28 import urllib.request, urllib.parse, urllib.error
29 29
30 30 from rhodecode.lib import utils
31 31 from rhodecode.lib.ext_json import json
@@ -91,7 +91,7 b' class SimpleHg(simplevcs.SimpleVCS):'
91 91 if not head:
92 92 break
93 93 i += 1
94 chunks.append(urllib.unquote_plus(head))
94 chunks.append(urllib.parse.unquote_plus(head))
95 95 full_arg = ''.join(chunks)
96 96 pref = 'cmds='
97 97 if full_arg.startswith(pref):
@@ -20,7 +20,7 b''
20 20
21 21 import base64
22 22 import logging
23 import urllib
23 import urllib.request, urllib.parse, urllib.error
24 24 import urlparse
25 25
26 26 import requests
@@ -124,7 +124,7 b' class SimpleSvnApp(object):'
124 124 def _get_url(self, svn_http_server, path):
125 125 svn_http_server_url = (svn_http_server or '').rstrip('/')
126 126 url_path = urlparse.urljoin(svn_http_server_url + '/', (path or '').lstrip('/'))
127 url_path = urllib.quote(url_path, safe="/:=~+!$,;'")
127 url_path = urllib.parse.quote(url_path, safe="/:=~+!$,;'")
128 128 return url_path
129 129
130 130 def _get_request_headers(self, environ):
@@ -31,7 +31,7 b' import logging'
31 31 import re
32 32 import sys
33 33 import time
34 import urllib
34 import urllib.request, urllib.parse, urllib.error
35 35 import urlobject
36 36 import uuid
37 37 import getpass
@@ -433,8 +433,7 b' def get_encryption_key(config):'
433 433 return secret or default
434 434
435 435
436 def age(prevdate, now=None, show_short_version=False, show_suffix=True,
437 short_format=False):
436 def age(prevdate, now=None, show_short_version=False, show_suffix=True, short_format=False):
438 437 """
439 438 Turns a datetime into an age string.
440 439 If show_short_version is True, this generates a shorter string with
@@ -602,7 +601,7 b' def cleaned_uri(uri):'
602 601 :param uri:
603 602 :return: uri without this chars
604 603 """
605 return urllib.quote(uri, safe='@$:/')
604 return urllib.parse.quote(uri, safe='@$:/')
606 605
607 606
608 607 def credentials_filter(uri):
@@ -632,7 +631,7 b' def get_host_info(request):'
632 631
633 632 qualified_home_url = request.route_url('home')
634 633 parsed_url = urlobject.URLObject(qualified_home_url)
635 decoded_path = safe_unicode(urllib.unquote(parsed_url.path.rstrip('/')))
634 decoded_path = safe_unicode(urllib.parse.unquote(parsed_url.path.rstrip('/')))
636 635
637 636 return {
638 637 'scheme': parsed_url.scheme,
@@ -644,7 +643,7 b' def get_host_info(request):'
644 643 def get_clone_url(request, uri_tmpl, repo_name, repo_id, repo_type, **override):
645 644 qualified_home_url = request.route_url('home')
646 645 parsed_url = urlobject.URLObject(qualified_home_url)
647 decoded_path = safe_unicode(urllib.unquote(parsed_url.path.rstrip('/')))
646 decoded_path = safe_unicode(urllib.parse.unquote(parsed_url.path.rstrip('/')))
648 647
649 648 args = {
650 649 'scheme': parsed_url.scheme,
@@ -659,7 +658,7 b' def get_clone_url(request, uri_tmpl, rep'
659 658 'repo_type': repo_type
660 659 }
661 660 args.update(override)
662 args['user'] = urllib.quote(safe_str(args['user']))
661 args['user'] = urllib.parse.quote(safe_str(args['user']))
663 662
664 663 for k, v in args.items():
665 664 uri_tmpl = uri_tmpl.replace('{%s}' % k, v)
@@ -24,7 +24,7 b' HG repository module'
24 24 import os
25 25 import logging
26 26 import binascii
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28
29 29 from zope.cachedescriptors.property import Lazy as LazyProperty
30 30
@@ -427,7 +427,7 b' class MercurialRepository(BaseRepository'
427 427 """
428 428 url = url.encode('utf8')
429 429 if url != 'default' and '://' not in url:
430 url = "file:" + urllib.pathname2url(url)
430 url = "file:" + urllib.request.pathname2url(url)
431 431 return url
432 432
433 433 def get_hook_location(self):
@@ -24,7 +24,7 b' SVN repository module'
24 24
25 25 import logging
26 26 import os
27 import urllib
27 import urllib.request, urllib.parse, urllib.error
28 28
29 29 from zope.cachedescriptors.property import Lazy as LazyProperty
30 30
@@ -234,7 +234,7 b' class SubversionRepository(base.BaseRepo'
234 234 """
235 235 # convert to URL if it's a local directory
236 236 if os.path.isdir(url):
237 url = 'file://' + urllib.pathname2url(url)
237 url = 'file://' + urllib.request.pathname2url(url)
238 238 return connection.Svn.check_url(url, config.serialize())
239 239
240 240 @staticmethod
@@ -366,5 +366,5 b' class SubversionRepository(base.BaseRepo'
366 366
367 367 def _sanitize_url(url):
368 368 if '://' not in url:
369 url = 'file://' + urllib.pathname2url(url)
369 url = 'file://' + urllib.request.pathname2url(url)
370 370 return url
@@ -26,7 +26,7 b' import copy'
26 26 import logging
27 27 import threading
28 28 import time
29 import urllib2
29 import urllib.request, urllib.error, urllib.parse
30 30 import urlparse
31 31 import uuid
32 32 import traceback
@@ -50,7 +50,7 b' log = logging.getLogger(__name__)'
50 50 # HTTPApplication.ALLOWED_EXCEPTIONS
51 51 EXCEPTIONS_MAP = {
52 52 'KeyError': KeyError,
53 'URLError': urllib2.URLError,
53 'URLError': urllib.error.URLError,
54 54 }
55 55
56 56
@@ -23,7 +23,7 b' Custom vcs exceptions module.'
23 23 """
24 24 import logging
25 25 import functools
26 import urllib2
26 import urllib.request, urllib.error, urllib.parse
27 27 import rhodecode
28 28
29 29 log = logging.getLogger(__name__)
@@ -166,7 +166,7 b' class UnhandledException(VCSError):'
166 166 'unhandled': UnhandledException,
167 167 # TODO: johbo: Define our own exception for this and stop abusing
168 168 # urllib's exception class.
169 'url_error': urllib2.URLError,
169 'url_error': urllib.error.URLError,
170 170 'subrepo_merge_error': SubrepoMergeError,
171 171 }
172 172
@@ -29,7 +29,7 b' import logging'
29 29 import os
30 30
31 31 import datetime
32 import urllib
32 import urllib.request, urllib.parse, urllib.error
33 33 import collections
34 34
35 35 from pyramid.threadlocal import get_current_request
@@ -1597,7 +1597,7 b' class PullRequestModel(BaseModel):'
1597 1597 if pull_request.is_closed():
1598 1598 return None
1599 1599 else:
1600 pr_url = urllib.unquote(self.get_url(pull_request, request=request))
1600 pr_url = urllib.parse.unquote(self.get_url(pull_request, request=request))
1601 1601 return safe_unicode('{pr_url}/repository'.format(pr_url=pr_url))
1602 1602
1603 1603 def _notify_reviewers(self, pull_request, user_ids, role, user):
@@ -19,7 +19,7 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import logging
22 import urllib2
22 import urllib.request, urllib.error, urllib.parse
23 23 from packaging.version import Version
24 24
25 25 import rhodecode
@@ -41,7 +41,7 b' class UpdateModel(BaseModel):'
41 41 """Return the JSON update data."""
42 42 ver = rhodecode.__version__
43 43 log.debug('Checking for upgrade on `%s` server', update_url)
44 opener = urllib2.build_opener()
44 opener = urllib.request.build_opener()
45 45 opener.addheaders = [('User-agent', 'RhodeCode-SCM/%s' % ver)]
46 46 response = opener.open(update_url)
47 47 response_data = response.read()
@@ -246,10 +246,10 b' def no_newline_id_generator(test_name):'
246 246
247 247
248 248 def route_path_generator(url_defs, name, params=None, **kwargs):
249 import urllib
249 import urllib.request, urllib.parse, urllib.error
250 250
251 251 base_url = url_defs[name].format(**kwargs)
252 252
253 253 if params:
254 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
254 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
255 255 return base_url
@@ -25,7 +25,7 b' from rhodecode.tests.fixture import Fixt'
25 25
26 26
27 27 def route_path(name, params=None, **kwargs):
28 import urllib
28 import urllib.request, urllib.parse, urllib.error
29 29 from rhodecode.apps._base import ADMIN_PREFIX
30 30
31 31 base_url = {
@@ -46,7 +46,7 b' def route_path(name, params=None, **kwar'
46 46 }[name].format(**kwargs)
47 47
48 48 if params:
49 base_url = '{}?{}'.format(base_url, urllib.urlencode(params))
49 base_url = '{}?{}'.format(base_url, urllib.parse.urlencode(params))
50 50 return base_url
51 51
52 52
@@ -35,7 +35,7 b' import subprocess32'
35 35 import sys
36 36 import time
37 37 import traceback
38 import urllib
38 import urllib.request, urllib.parse, urllib.error
39 39
40 40 PROFILING_INTERVAL = 5
41 41 RC_WEBSITE = "http://localhost:5001/"
@@ -130,7 +130,7 b' rc.stdin.write("y\\n")'
130 130 # Verify that the website is up
131 131 time.sleep(4)
132 132 try:
133 urllib.urlopen(RC_WEBSITE)
133 urllib.request.urlopen(RC_WEBSITE)
134 134 except IOError:
135 135 print("RC - Website not started")
136 136 vcs.terminate()
@@ -28,8 +28,8 b' watch -n1 ./rhodecode/tests/mem_watch'
28 28
29 29
30 30 import cookielib
31 import urllib
32 import urllib2
31 import urllib.request, urllib.parse, urllib.error
32 import urllib.request, urllib.error, urllib.parse
33 33 import time
34 34 import os
35 35 import sys
@@ -66,13 +66,13 b' PROJECTS = ['
66 66
67 67
68 68 cj = cookielib.FileCookieJar('/tmp/rc_test_cookie.txt')
69 o = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
69 o = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
70 70 o.addheaders = [
71 71 ('User-agent', 'rhodecode-crawler'),
72 72 ('Accept-Language', 'en - us, en;q = 0.5')
73 73 ]
74 74
75 urllib2.install_opener(o)
75 urllib.request.install_opener(o)
76 76
77 77
78 78 def _get_repo(proj):
@@ -94,7 +94,7 b' def test_changelog_walk(proj, pages=100)'
94 94
95 95 page = '/'.join((proj, 'changelog',))
96 96
97 full_uri = (BASE_URI % page) + '?' + urllib.urlencode({'page': i})
97 full_uri = (BASE_URI % page) + '?' + urllib.parse.urlencode({'page': i})
98 98 s = time.time()
99 99 f = o.open(full_uri)
100 100
@@ -26,8 +26,8 b' import pytest'
26 26 import subprocess32
27 27 import configobj
28 28 import logging
29
30 from urllib2 import urlopen, URLError
29 from urllib.request import urlopen
30 from urllib.error import URLError
31 31 from pyramid.compat import configparser
32 32
33 33
@@ -24,11 +24,11 b' import logging'
24 24 import os.path
25 25 import subprocess32
26 26 import tempfile
27 import urllib2
27 import urllib.request, urllib.error, urllib.parse
28 28 from lxml.html import fromstring, tostring
29 29 from lxml.cssselect import CSSSelector
30 30 from urlparse import urlparse, parse_qsl
31 from urllib import unquote_plus
31 from urllib.parse import unquote_plus
32 32 import webob
33 33
34 34 from webtest.app import TestResponse, TestApp, string_types
@@ -390,8 +390,8 b' def wait_for_url(url, timeout=10):'
390 390
391 391 def is_url_reachable(url):
392 392 try:
393 urllib2.urlopen(url)
394 except urllib2.URLError:
393 urllib.request.urlopen(url)
394 except urllib.error.URLError:
395 395 log.exception('URL `{}` reach error'.format(url))
396 396 return False
397 397 return True
@@ -19,7 +19,7 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import datetime
22 from urllib2 import URLError
22 from urllib.error import URLError
23 23
24 24 import mock
25 25 import pytest
General Comments 0
You need to be logged in to leave comments. Login now