Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting cherrypy WSGI Server import path according to new release #3235

Merged
merged 8 commits into from Mar 9, 2018
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -314,3 +314,5 @@ Contributors
- Lars Blumberg, 2017/08/14

- Deneys Maartens, 2017/11/03

- Heron Rossi, 2018/03/08
15 changes: 9 additions & 6 deletions pyramid/scripts/pserve.py
Expand Up @@ -341,18 +341,21 @@ def cherrypy_server_runner(
if var is not None:
kwargs[var_name] = int(var)

from cherrypy import wsgiserver
try:
from cheroot.wsgi import Server as WSGIServer
except ImportError:
from cherrypy.wsgiserver import CherryPyWSGIServer as WSGIServer

server = wsgiserver.CherryPyWSGIServer(bind_addr, app,
server_name=server_name, **kwargs)
server = WSGIServer(bind_addr, app,
server_name=server_name, **kwargs)
if ssl_pem is not None:
if PY2:
server.ssl_certificate = server.ssl_private_key = ssl_pem
else:
# creates wsgiserver.ssl_builtin as side-effect
wsgiserver.get_ssl_adapter_class()
server.ssl_adapter = wsgiserver.ssl_builtin.BuiltinSSLAdapter(
ssl_pem, ssl_pem)
from cherrypy.wsgiserver import get_ssl_adapter_class, ssl_builtin
get_ssl_adapter_class()
server.ssl_adapter = ssl_builtin.BuiltinSSLAdapter(ssl_pem, ssl_pem)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part needs to use cheroot, too. E.g.:

try:
    from cheroot.server import get_ssl_adapter_class
except ImportError:
    from cherrypy.wsgiserver import get_ssl_adapter_class

try:
    from cheroot.ssl.builtin import BuiltinSSLAdapter
except ImportError:
    from cherrypy.wsgiserver.ssl_builtin import BuiltinSSLAdapter


if protocol_version:
server.protocol = protocol_version
Expand Down