diff MoinMoin/support/flup/client/scgi_app.py @ 5804:2e7f76626b58

update flup to repo tip (no release since 1.0.2 / 2.5y)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 01 Dec 2011 02:38:57 +0100
parents eb463542664e
children
line wrap: on
line diff
--- a/MoinMoin/support/flup/client/scgi_app.py	Thu Dec 01 02:26:16 2011 +0100
+++ b/MoinMoin/support/flup/client/scgi_app.py	Thu Dec 01 02:38:57 2011 +0100
@@ -31,6 +31,7 @@
 import struct
 import socket
 import errno
+import types
 
 __all__ = ['SCGIApp']
 
@@ -136,11 +137,14 @@
         return [result]
 
     def _getConnection(self):
-        if type(self._connect) is str:
+        if isinstance(self._connect, types.StringTypes):
             sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+            sock.connect(self._connect)
+        elif hasattr(socket, 'create_connection'):
+            sock = socket.create_connection(self._connect)
         else:
             sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        sock.connect(self._connect)
+            sock.connect(self._connect)
         return sock
     
     _environPrefixes = ['SERVER_', 'HTTP_', 'REQUEST_', 'REMOTE_', 'PATH_',