mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge remote-tracking branch 'origin/release_16.07' into release_16.10
This commit is contained in:
@@ -8,8 +8,9 @@ import gzip
|
||||
import line
|
||||
import subprocess
|
||||
import tempfile
|
||||
import urllib
|
||||
import urllib2
|
||||
|
||||
from six.moves.urllib.parse import urlencode, urlparse
|
||||
from six.moves.urllib.request import urlopen
|
||||
|
||||
_TODO = """
|
||||
YAGNI: ftp, image, cryptos, sockets
|
||||
@@ -105,13 +106,16 @@ class URLDataProvider( base.DataProvider ):
|
||||
self.method = method
|
||||
|
||||
self.data = data or {}
|
||||
encoded_data = urllib.urlencode( self.data )
|
||||
encoded_data = urlencode( self.data )
|
||||
|
||||
scheme = urlparse(url).scheme
|
||||
assert scheme in ('http', 'https', 'ftp'), 'Invalid URL scheme: %s' % scheme
|
||||
|
||||
if method == 'GET':
|
||||
self.url += '?%s' % ( encoded_data )
|
||||
opened = urllib2.urlopen( url )
|
||||
opened = urlopen( url )
|
||||
elif method == 'POST':
|
||||
opened = urllib2.urlopen( url, encoded_data )
|
||||
opened = urlopen( url, encoded_data )
|
||||
else:
|
||||
raise ValueError( 'Not a valid method: %s' % ( method ) )
|
||||
|
||||
|
||||
@@ -1459,6 +1459,7 @@ def build_url( base_url, port=80, scheme='http', pathspec=None, params=None, dos
|
||||
parsed_url = urlparse.urlparse( base_url )
|
||||
if scheme != 'http':
|
||||
parsed_url.scheme = scheme
|
||||
assert parsed_url.scheme in ('http', 'https', 'ftp'), 'Invalid URL scheme: %s' % scheme
|
||||
if port != 80:
|
||||
url = '%s://%s:%d/%s' % ( parsed_url.scheme, parsed_url.netloc.rstrip( '/' ), int( port ), parsed_url.path )
|
||||
else:
|
||||
|
||||
+9
-4
@@ -6,7 +6,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
|
||||
from six.moves.urllib.parse import urlencode
|
||||
from six.moves.urllib.parse import urlencode, urlparse
|
||||
from six.moves.urllib.request import Request, urlopen
|
||||
|
||||
from galaxy.util import asbool, build_url, url_get
|
||||
@@ -380,9 +380,8 @@ class RepositoryDependencyInstallManager( object ):
|
||||
pathspec = [ 'repository', 'get_required_repo_info_dict' ]
|
||||
url = build_url( tool_shed_url, pathspec=pathspec )
|
||||
# Fix for handling 307 redirect not being handled nicely by urlopen() when the Request() has data provided
|
||||
url = urlopen( Request( url ) ).geturl()
|
||||
request = Request( url, data=urlencode( dict( encoded_str=encoded_required_repository_str ) ) )
|
||||
response = urlopen( request ).read()
|
||||
url = _urlopen(url).geturl()
|
||||
response = _urlopen(url, urlencode(dict(encoded_str=encoded_required_repository_str))).read()
|
||||
if response:
|
||||
try:
|
||||
required_repo_info_dict = json.loads( response )
|
||||
@@ -469,3 +468,9 @@ class RepositoryDependencyInstallManager( object ):
|
||||
repository.error_message = None
|
||||
self.app.install_model.context.add( repository )
|
||||
self.app.install_model.context.flush()
|
||||
|
||||
|
||||
def _urlopen(url, data=None):
|
||||
scheme = urlparse(url).scheme
|
||||
assert scheme in ('http', 'https', 'ftp'), 'Invalid URL scheme: %s' % scheme
|
||||
return urlopen(Request(url, data))
|
||||
|
||||
Reference in New Issue
Block a user