Robert Brewer avatar Robert Brewer committed 265d37e

Some Py2 fixups

Comments (0)

Files changed (2)

cheroot/ssllib/ssl_pyopenssl.py

 import threading
 import time
 
-from cheroot import py2makefile
+from cheroot import errors, py2makefile
+from cheroot.ssllib import SSLAdapter
 
 try:
     from OpenSSL import SSL
                     return ""
                 
                 errnum = e.args[0]
-                if is_reader and errnum in wsgiserver.socket_errors_to_ignore:
+                if is_reader and errnum in errors.socket_errors_to_ignore:
                     return ""
                 raise socket.error(errnum)
             except SSL.Error, e:
                 
                 if thirdarg == 'http request':
                     # The client is talking HTTP to an HTTPS server.
-                    raise wsgiserver.NoSSLError()
+                    raise errors.NoSSLError()
                 
-                raise wsgiserver.FatalSSLAlert(*e.args)
+                raise errors.FatalSSLAlert(*e.args)
             except:
                 raise
             
             self._lock.release()
 
 
-class pyOpenSSLAdapter(wsgiserver.SSLAdapter):
+class pyOpenSSLAdapter(SSLAdapter):
     """A wrapper for integrating pyOpenSSL with Cheroot."""
     
     context = None

cheroot/test/test_core.py

 
 class SSLTest(helper.CherootWebCase):
 
-    config = {"ssl_adapter": helper.get_default_ssl_adapter()}
-
     def setup_server(cls):
         class Root(helper.Controller):
 
                 return "hello"
 
         cls.httpserver.wsgi_app = Root()
+        cls.httpserver.ssl_adapter = helper.get_default_ssl_adapter()
+
     setup_server = classmethod(setup_server)
 
     def test_normal(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.