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
1 changed files with 5 additions and 2 deletions

View File

@ -2792,7 +2792,10 @@ class WSGIRefServer(ServerAdapter):
class CherryPyServer(ServerAdapter):
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['wsgi_app'] = handler
@ -2803,7 +2806,7 @@ class CherryPyServer(ServerAdapter):
if keyfile:
del self.options['keyfile']
server = wsgiserver.CherryPyWSGIServer(**self.options)
server = CherryPyWSGIServer(**self.options)
if certfile:
server.ssl_certificate = certfile
if keyfile: