1
0
mirror of https://github.com/pypiserver/pypiserver synced 2024-11-09 16:45:51 +01:00

Fix cherrypy CherryPyWSGIServer import (#301)

CherryPy changed the import location.
This attempts the new or falls back to the old location.

Co-authored-by: Tiemen Schuijbroek <t.j.l.schuijbroek@ratio-case.nl>
This commit is contained in:
Tiemen Schuijbroek 2020-07-10 05:10:44 +02:00 committed by GitHub
parent 54d35cdbaf
commit 5b14270d0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2792,7 +2792,10 @@ class WSGIRefServer(ServerAdapter):
class CherryPyServer(ServerAdapter): class CherryPyServer(ServerAdapter):
def run(self, handler): # pragma: no cover def run(self, handler): # pragma: no cover
from cherrypy import wsgiserver try:
from cheroot.wsgi import Server as CherryPyWSGIServer
except ImportError:
from cherrypy.wsgiserver import CherryPyWSGIServer
self.options['bind_addr'] = (self.host, self.port) self.options['bind_addr'] = (self.host, self.port)
self.options['wsgi_app'] = handler self.options['wsgi_app'] = handler
@ -2803,7 +2806,7 @@ class CherryPyServer(ServerAdapter):
if keyfile: if keyfile:
del self.options['keyfile'] del self.options['keyfile']
server = wsgiserver.CherryPyWSGIServer(**self.options) server = CherryPyWSGIServer(**self.options)
if certfile: if certfile:
server.ssl_certificate = certfile server.ssl_certificate = certfile
if keyfile: if keyfile: