Robert Brewer avatar Robert Brewer committed bf9a17c

Buried a couple socket, threading module imports for easier Google App Engine integration.

Comments (0)

Files changed (2)

cherrypy/_cpserver.py

 """Manage HTTP servers with CherryPy."""
 
-import socket
 import warnings
 
 import cherrypy
             # 0.0.0.0 is INADDR_ANY and :: is IN6ADDR_ANY.
             # Look up the host name, which should be the
             # safest thing to spit out in a URL.
+            import socket
             host = socket.gethostname()
         
         port = self.socket_port

cherrypy/process/servers.py

 """Adapt an HTTP server."""
 
-import socket
-import threading
 import time
 
 
         if isinstance(self.bind_addr, tuple):
             wait_for_free_port(*self.bind_addr)
         
+        import threading
         t = threading.Thread(target=self._start_http_thread)
         t.setName("HTTPServer " + t.getName())
         t.start()
     host = client_host(host)
     port = int(port)
     
+    import socket
+    
     # AF_INET or AF_INET6 socket
     # Get the correct address family for our host (allows IPv6 addresses)
     for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC,
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.