Merge pull request #5200 from nsoranzo/python3

Fix Python3 compatibility for lib/galaxy/web/
This commit is contained in:
Dannon Baker
2017-12-13 17:03:51 -05:00
committed by GitHub
8 changed files with 12 additions and 22 deletions
+1 -11
View File
@@ -27,17 +27,7 @@ lib/galaxy/tools/
lib/galaxy/tours/
lib/galaxy/util/
lib/galaxy/visualization/
lib/galaxy/web/base/
lib/galaxy/web/buildapp.py
lib/galaxy/web/framework/base.py
lib/galaxy/web/framework/decorators.py
lib/galaxy/web/framework/helpers/grids.py
lib/galaxy/web/framework/__init__.py
lib/galaxy/web/framework/middleware/error.py
lib/galaxy/web/framework/middleware/static.py
lib/galaxy/web/framework/middleware/statsd.py
lib/galaxy/web/framework/webapp.py
lib/galaxy/web/__init__.py
lib/galaxy/web/
lib/galaxy/webapps/galaxy/api/histories.py
lib/galaxy/webapps/galaxy/api/library_datasets.py
lib/galaxy/webapps/galaxy/api/tours.py
+1 -1
View File
@@ -23,10 +23,10 @@ import io
import json
import logging
import re
from urlparse import urlparse
import routes
from paste import httpexceptions
from six.moves.urllib.parse import urlparse
log = logging.getLogger(__name__)
@@ -149,7 +149,7 @@ def get_func_list(stats, sel_list):
list = stats.fcn_list[:]
order_message = "Ordered by: " + stats.sort_type
else:
list = stats.stats.keys()
list = list(stats.stats.keys())
order_message = "Random listing order was used"
# Do the selection and accumulate messages
select_message = ""
@@ -192,7 +192,7 @@ class RemoteUser(object):
return self.app(environ, start_response)
else:
log.debug("Unable to identify user. %s not found" % self.remote_user_header)
for k, v in environ.iteritems():
for k, v in environ.items():
log.debug("%s = %s", k, v)
title = "Access to Galaxy is denied"
@@ -5,9 +5,9 @@ Middleware for logging requests, using Apache combined log format
"""
import logging
import time
import urllib
from six import string_types
from six.moves.urllib.parse import quote
class TransLogger(object):
@@ -52,8 +52,8 @@ class TransLogger(object):
def __call__(self, environ, start_response):
start = time.localtime()
req_uri = urllib.quote(environ.get('SCRIPT_NAME', '') +
environ.get('PATH_INFO', ''))
req_uri = quote(environ.get('SCRIPT_NAME', '') +
environ.get('PATH_INFO', ''))
if environ.get('QUERY_STRING'):
req_uri += '?' + environ['QUERY_STRING']
method = environ['REQUEST_METHOD']
+1 -1
View File
@@ -98,7 +98,7 @@ class SecurityHelper(object):
if recursive and isinstance(v, dict):
rval[k] = self.encode_all_ids(v, recursive)
elif recursive and isinstance(v, list):
rval[k] = map(lambda el: self.encode_all_ids(el, True), v)
rval[k] = [self.encode_all_ids(el, True) for el in v]
return rval
def decode_id(self, obj_id, kind=None):
+2 -2
View File
@@ -370,8 +370,8 @@ def _do_uwsgi_postfork():
def _mule_fixup():
import urllib2
urllib2._opener = None
from six.moves.urllib.request import install_opener
install_opener(None)
if uwsgi:
+2 -2
View File
@@ -76,7 +76,7 @@ class UWSGIFarmMessageTransport(ApplicationStackTransport):
if num < need:
raise RuntimeError('Need %i uWSGI locks but only %i exist(s): Set `locks = %i` in uWSGI configuration' % (need, num, need - 1))
sys.exit(1)
self._locks.extend(map(lambda x: 'RECV_MSG_FARM_' + x, farms))
self._locks.extend(['RECV_MSG_FARM_' + x for x in farms])
# this would be nice, but in my 2.0.15 uWSGI, the uwsgi module has no set_option function, and I don't know if it'd work even if the function existed as documented
# if len(self.lock_map) > 1:
# uwsgi.set_option('locks', len(self.lock_map))
@@ -136,7 +136,7 @@ class UWSGIFarmMessageTransport(ApplicationStackTransport):
if not uwsgi.in_farm():
raise RuntimeError('Mule %s is not in a farm! Set `farm = <pool_name>:%s` in uWSGI configuration'
% (uwsgi.mule_id(),
','.join(map(str, range(1, len(filter(lambda x: x.endswith('galaxy/main.py'), self.stack._configured_mules)) + 1)))))
','.join(map(str, range(1, len([x for x in self.stack._configured_mules if x.endswith('galaxy/main.py')]) + 1)))))
elif len(self.stack._farms) > 1:
raise RuntimeError('Mule %s is in multiple farms! This configuration is not supported due to locking issues' % uwsgi.mule_id())
# only mules receive messages so don't bother starting the dispatcher if we're not a mule (although