python3: fixed urllib usage
This commit is contained in:
parent
98d140d533
commit
0c53201403
9 changed files with 11 additions and 12 deletions
|
|
@ -90,7 +90,7 @@ def store_user_in_session(session, username, remember=False):
|
|||
|
||||
def get_came_from(request):
|
||||
came_from = safe_str(request.GET.get('came_from', ''))
|
||||
parsed = urllib.parse.urlparse.urlparse(came_from)
|
||||
parsed = urllib.parse.urlparse(came_from)
|
||||
allowed_schemes = ['http', 'https']
|
||||
default_came_from = h.route_path('home')
|
||||
if parsed.scheme and parsed.scheme not in allowed_schemes:
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class SubversionTunnelWrapper(object):
|
|||
if not first_response:
|
||||
return self.fail("Repository name cannot be extracted")
|
||||
|
||||
url_parts = urllib.parse.urlparse.urlparse(first_response['url'])
|
||||
url_parts = urllib.parse.urlparse(first_response['url'])
|
||||
|
||||
self.server.repo_name = self._match_repo_name(url_parts.path.strip('/'))
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ def relative_path(path, request_path, is_repo_file=None):
|
|||
# skip data, anchor, invalid links
|
||||
return path
|
||||
|
||||
is_absolute = bool(urllib.parse.urlparse.urlparse(path).netloc)
|
||||
is_absolute = bool(urllib.parse.urlparse(path).netloc)
|
||||
if is_absolute:
|
||||
return path
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class SimpleSvnApp(object):
|
|||
|
||||
def _get_url(self, svn_http_server, path):
|
||||
svn_http_server_url = (svn_http_server or '').rstrip('/')
|
||||
url_path = urllib.parse.urlparse.urljoin(svn_http_server_url + '/', (path or '').lstrip('/'))
|
||||
url_path = urllib.parse.urljoin(svn_http_server_url + '/', (path or '').lstrip('/'))
|
||||
url_path = urllib.parse.quote(url_path, safe="/:=~+!$,;'")
|
||||
return url_path
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class VcsHttpProxy(object):
|
|||
|
||||
# Preserve the query string
|
||||
url = self._url
|
||||
url = urllib.parse.urlparse.urljoin(url, self._repo_name)
|
||||
url = urllib.parse.urljoin(url, self._repo_name)
|
||||
if environ.get('QUERY_STRING'):
|
||||
url += '?' + environ['QUERY_STRING']
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ def _streaming_remote_call(url, payload, exceptions_map, session, chunk_size):
|
|||
|
||||
class ServiceConnection(object):
|
||||
def __init__(self, server_and_port, backend_endpoint, session_factory):
|
||||
self.url = urllib.parse.urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
|
||||
self.url = urllib.parse.urljoin('http://%s' % server_and_port, backend_endpoint)
|
||||
self._session_factory = session_factory
|
||||
|
||||
def __getattr__(self, name):
|
||||
|
|
@ -154,8 +154,8 @@ class ServiceConnection(object):
|
|||
class RemoteVCSMaker(object):
|
||||
|
||||
def __init__(self, server_and_port, backend_endpoint, backend_type, session_factory):
|
||||
self.url = urllib.parse.urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
|
||||
self.stream_url = urllib.parse.urlparse.urljoin('http://%s' % server_and_port, backend_endpoint+'/stream')
|
||||
self.url = urllib.parse.urljoin('http://%s' % server_and_port, backend_endpoint)
|
||||
self.stream_url = urllib.parse.urljoin('http://%s' % server_and_port, backend_endpoint+'/stream')
|
||||
|
||||
self._session_factory = session_factory
|
||||
self.backend_type = backend_type
|
||||
|
|
@ -356,7 +356,7 @@ class VcsHttpProxy(object):
|
|||
retries = Retry(total=5, connect=None, read=None, redirect=None)
|
||||
|
||||
adapter = requests.adapters.HTTPAdapter(max_retries=retries)
|
||||
self.base_url = urllib.parse.urlparse.urljoin('http://%s' % server_and_port, backend_endpoint)
|
||||
self.base_url = urllib.parse.urljoin('http://%s' % server_and_port, backend_endpoint)
|
||||
self.session = requests.Session()
|
||||
self.session.mount('http://', adapter)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import rhodecode.lib.middleware.simplegit as simplegit
|
|||
|
||||
def get_environ(url, request_method):
|
||||
"""Construct a minimum WSGI environ based on the URL."""
|
||||
parsed_url = urllib.parse.urlparse.urlparse(url)
|
||||
parsed_url = urllib.parse.urlparse(url)
|
||||
environ = {
|
||||
'PATH_INFO': parsed_url.path,
|
||||
'QUERY_STRING': parsed_url.query,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import rhodecode.lib.middleware.simplehg as simplehg
|
|||
|
||||
def get_environ(url):
|
||||
"""Construct a minimum WSGI environ based on the URL."""
|
||||
parsed_url = urllib.parse.urlparse.urlparse(url)
|
||||
parsed_url = urllib.parse.urlparse(url)
|
||||
environ = {
|
||||
'PATH_INFO': parsed_url.path,
|
||||
'QUERY_STRING': parsed_url.query,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import tempfile
|
|||
import urllib.request, urllib.error, urllib.parse
|
||||
from lxml.html import fromstring, tostring
|
||||
from lxml.cssselect import CSSSelector
|
||||
import urllib.parse.urlparse
|
||||
from urllib.parse import unquote_plus
|
||||
import webob
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue