[CalendarServer-changes] [5643] CalDAVTester/trunk/src/httpshandler.py

source_changes at macosforge.org source_changes at macosforge.org
Sat May 22 17:41:28 PDT 2010


Revision: 5643
          http://trac.macosforge.org/projects/calendarserver/changeset/5643
Author:   cdaboo at apple.com
Date:     2010-05-22 17:41:22 -0700 (Sat, 22 May 2010)
Log Message:
-----------
Fix import issue with Python 2.5.

Modified Paths:
--------------
    CalDAVTester/trunk/src/httpshandler.py

Modified: CalDAVTester/trunk/src/httpshandler.py
===================================================================
--- CalDAVTester/trunk/src/httpshandler.py	2010-05-21 23:06:38 UTC (rev 5642)
+++ CalDAVTester/trunk/src/httpshandler.py	2010-05-23 00:41:22 UTC (rev 5643)
@@ -16,17 +16,25 @@
 
 import httplib
 import socket
-import ssl as sslmodule
+_haveSSL = False
+try:
+    import ssl as sslmodule
+    _haveSSL = True
+except ImportError:
+    pass
 
-class HTTPSConnection_SSLv3(httplib.HTTPSConnection):
-    "This class allows communication via SSL."
+if _haveSSL:
+    class HTTPSConnection_SSLv3(httplib.HTTPSConnection):
+        "This class allows communication via SSL."
+    
+        def connect(self):
+            "Connect to a host on a given (SSL) port."
+    
+            sock = socket.create_connection((self.host, self.port), self.timeout)
+            self.sock = sslmodule.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=sslmodule.PROTOCOL_SSLv3)
+else:
+    HTTPSConnection_SSLv3 = httplib.HTTPSConnection
 
-    def connect(self):
-        "Connect to a host on a given (SSL) port."
-
-        sock = socket.create_connection((self.host, self.port), self.timeout)
-        self.sock = sslmodule.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=sslmodule.PROTOCOL_SSLv3)
-
 https_v23_connects = set()
 https_v3_connects = set()
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100522/d05e9d1a/attachment.html>


More information about the calendarserver-changes mailing list