[Checkins] SVN: zc.ssl/trunk/ Adapt to Python 2.6. Still compatible with 2.5 and 2.4.

Zvezdan Petkovic zvezdan at zope.com
Wed Apr 7 14:36:55 EDT 2010


Log message for revision 110605:
  Adapt to Python 2.6.  Still compatible with 2.5 and 2.4.
  
  

Changed:
  U   zc.ssl/trunk/CHANGES.txt
  U   zc.ssl/trunk/setup.py
  U   zc.ssl/trunk/src/zc/ssl/__init__.py

-=-
Modified: zc.ssl/trunk/CHANGES.txt
===================================================================
--- zc.ssl/trunk/CHANGES.txt	2010-04-07 18:21:23 UTC (rev 110604)
+++ zc.ssl/trunk/CHANGES.txt	2010-04-07 18:36:54 UTC (rev 110605)
@@ -1,6 +1,7 @@
-1.2 (Unreleased)
+1.2 (2010-04-07)
 ================
 
+- Python 2.6 has ssl in the standard library.  Adapt accordingly.
 
 1.1 (2008-07-01)
 ================

Modified: zc.ssl/trunk/setup.py
===================================================================
--- zc.ssl/trunk/setup.py	2010-04-07 18:21:23 UTC (rev 110604)
+++ zc.ssl/trunk/setup.py	2010-04-07 18:36:54 UTC (rev 110605)
@@ -1,5 +1,14 @@
+import sys
 from setuptools import setup, find_packages
 
+install_requires = [
+    'setuptools',
+    'zope.testing',
+    ]
+
+if sys.version_info < (2, 6, 0):
+    install_requires.append('ssl-for-setuptools')
+
 setup(
     name = "zc.ssl",
     version = "1.2dev",
@@ -12,11 +21,7 @@
     zip_safe = False,
     package_dir = {'':'src'},
     namespace_packages = ['zc'],
-    install_requires = [
-       'setuptools',
-       'ssl-for-setuptools',
-       'zope.testing',
-       ],
+    install_requires = install_requires,
     dependency_links = ['http://download.zope.org/distribution/'],
     license = "ZPL 2.1",
     )

Modified: zc.ssl/trunk/src/zc/ssl/__init__.py
===================================================================
--- zc.ssl/trunk/src/zc/ssl/__init__.py	2010-04-07 18:21:23 UTC (rev 110604)
+++ zc.ssl/trunk/src/zc/ssl/__init__.py	2010-04-07 18:36:54 UTC (rev 110605)
@@ -9,6 +9,7 @@
 import httplib
 import ssl
 import os.path
+import sys
 
 
 class HTTPSConnection(httplib.HTTPSConnection):
@@ -16,10 +17,15 @@
 
     def __init__(self, host, port=None, key_file=None, cert_file=None,
                  strict=None, timeout=None):
-        # timeout is None or float
-        self.timeout = timeout
-        httplib.HTTPSConnection.__init__(self, host, port, key_file, cert_file,
-                                         strict)
+        if sys.version_info < (2, 6, 0):
+            # timeout is None or float
+            self.timeout = timeout
+            httplib.HTTPSConnection.__init__(
+                self, host, port, key_file, cert_file, strict)
+        else:
+            httplib.HTTPSConnection.__init__(
+                self, host, port, key_file, cert_file, strict, timeout)
+
         if self.cert_file is None:
             self.cert_file = os.path.join(os.path.dirname(__file__),
                                           "certs.pem")



More information about the checkins mailing list