Browse files

Make ``pserve.cherrypy_server_runner`` Python 3 compatible.

Closes #718
  • Loading branch information...
1 parent bcfd25c commit d6e8b86723d8601df924ec31205f016b86778b98 @tomster tomster committed Aug 15, 2013
Showing with 11 additions and 1 deletion.
  1. +3 −0 CHANGES.txt
  2. +8 −1 pyramid/scripts/pserve.py
View
3 CHANGES.txt
@@ -183,6 +183,9 @@ Bug Fixes
default. See
https://github.com/Pylons/pyramid/issues/1040
+- Make ``pserve.cherrypy_server_runner`` Python 3 compatible. See
+ https://github.com/Pylons/pyramid/issues/718
+
Backwards Incompatibilities
---------------------------
View
9 pyramid/scripts/pserve.py
@@ -959,7 +959,14 @@ def cherrypy_server_runner(
server = wsgiserver.CherryPyWSGIServer(bind_addr, app,
server_name=server_name, **kwargs)
- server.ssl_certificate = server.ssl_private_key = ssl_pem
+ if ssl_pem is not None:
+ import sys
+ if sys.version_info < (3, 0):
+ server.ssl_certificate = server.ssl_private_key = ssl_pem
+ else:
+ wsgiserver.get_ssl_adapter_class() # creates wsgiserver.ssl_builtin as side-effect
+ server.ssl_adapter = wsgiserver.ssl_builtin.BuiltinSSLAdapter(ssl_pem, ssl_pem)
+
if protocol_version:
server.protocol = protocol_version

0 comments on commit d6e8b86

Please sign in to comment.