Fixes the following exception:
```
AttributeError: 'NoneType' object has no attribute 'id'
File "galaxy/web/framework/middleware/sentry.py", line 43, in __call__
iterable = self.application(environ, start_response)
File "/srv/toolshed/main/venv/local/lib/python2.7/site-packages/paste/translogger.py", line 69, in __call__
return self.application(environ, replacement_start_response)
File "/srv/toolshed/main/venv/local/lib/python2.7/site-packages/paste/recursive.py", line 85, in __call__
return self.application(environ, start_response)
File "routes/middleware.py", line 141, in __call__
response = self.app(environ, start_response)
File "/srv/toolshed/main/venv/local/lib/python2.7/site-packages/paste/httpexceptions.py", line 640, in __call__
return self.application(environ, start_response)
File "galaxy/web/framework/base.py", line 143, in __call__
return self.handle_request(environ, start_response)
File "galaxy/web/framework/base.py", line 222, in handle_request
body = method(trans, **kwargs)
File "galaxy/webapps/tool_shed/controllers/repository.py", line 888, in display_tool
tool_state = tool_util.new_state(trans, tool, invalid=False)
File "tool_shed/util/tool_util.py", line 211, in new_state
log.debug('Failed to build tool state for tool "%s" using standard method, will try to fall back on custom method: %s', tool.id, e)
```
(from https://sentry.galaxyproject.org/sentry/toolshed/issues/279820/).
Might also fix some other issues when redering workflow svg for
workflows with invalid tools.
Found this by removing the blank try/except in the previous commit.
This only affects testing when python can't determine the correct
locale and falls back to ASCII.
The Lock wasn't actually preventing anything, and I don't think
anything would need ot be protected here. mkdtemp should be thread-safe.
We also remove the try/except Statement. I think it'd be better to
expose any exceptions here instead of producing broken capsules and
logging an exception.
This drops xml_to_string from lib/tool_shed/util/xml_util.py
and uses xml_to_string form lib/galaxy/utils/__init__.py.
Also reduces plain string manipulation of xml structures.
Uses xml.dom.minidom to make xml pretty if necessary.
and starting Galaxy with `APP_WEBSERVER=gunicorn sh run.sh`.
Additional gunicorn cmdline arguments can be passed using
`GUNICORN_CMD_ARGS`. In a first pass this will allow
running planemo {server, test} under python 3, as Paste
has some problems under python 3:
```
galaxy.web.stack INFO 2018-09-29 22:16:00,216 Galaxy server instance 'main' is running
Traceback (most recent call last):
File "./scripts/paster.py", line 27, in <module>
serve.run()
File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 1055, in run
invoke(command, command_name, options, args[1:])
File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 1061, in invoke
exit_code = runner.run(args)
File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 226, in run
result = self.command()
File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 676, in command
serve()
File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 653, in serve
server(app)
File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/loadwsgi.py", line 232, in server_wrapper
**context.local_conf)
File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/loadwsgi.py", line 90, in fix_call
val = callable(*args, **kw)
File "/home/travis/.planemo/gx_venv_3_release_18.09/lib/python3.6/site-packages/paste/httpserver.py", line 1353, in server_runner
for name, value in kwargs.items():
RuntimeError: dictionary changed size during iteration
```
That said gunicorn is a nice pure-python alternative to paste going
forward.