diff options
author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2018-02-12 15:20:10 +0200 |
---|---|---|
committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2018-02-12 15:21:36 +0200 |
commit | eaad94d6477beb3f2a218ccf1bff08dcceef3c51 (patch) | |
tree | 0411c8879cf777099575f096d901d047b05ea2c7 /example | |
parent | bc6d4cdacd0f66a68c2b0f7bdf9856387776dce8 (diff) | |
download | pysaml2-eaad94d6477beb3f2a218ccf1bff08dcceef3c51.tar.gz |
Fix wsgiserver usage for example sp
Diffstat (limited to 'example')
-rwxr-xr-x | example/sp-wsgi/sp.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/example/sp-wsgi/sp.py b/example/sp-wsgi/sp.py index be1e8e68..9de43abe 100755 --- a/example/sp-wsgi/sp.py +++ b/example/sp-wsgi/sp.py @@ -849,7 +849,12 @@ def application(environ, start_response): if __name__ == '__main__': - from cherrypy import wsgiserver + try: + from cheroot.wsgi import Server as WSGIServer + from cheroot.ssl import pyopenssl + except ImportError: + from cherrypy.wsgiserver import CherryPyWSGIServer as WSGIServer + from cherrypy.wsgiserver import ssl_pyopenssl as pyopenssl _parser = argparse.ArgumentParser() _parser.add_argument('-d', dest='debug', action='store_true', @@ -923,14 +928,12 @@ if __name__ == '__main__': pass ds.DefaultSignature(sign_alg, digest_alg) - SRV = wsgiserver.CherryPyWSGIServer((HOST, PORT), application) + SRV = WSGIServer((HOST, PORT), application) _https = "" if service_conf.HTTPS: - from cherrypy.wsgiserver import ssl_pyopenssl - - SRV.ssl_adapter = ssl_pyopenssl.pyOpenSSLAdapter(SERVER_CERT, - SERVER_KEY, CERT_CHAIN) + SRV.ssl_adapter = pyopenssl.pyOpenSSLAdapter( + SERVER_CERT, SERVER_KEY, CERT_CHAIN) _https = " using SSL/TLS" logger.info("Server starting") print("SP listening on %s:%s%s" % (HOST, PORT, _https)) |