[Zope-Checkins] SVN: Zope/branches/gsoc-python-2.5/ - Launchpad #280334: Fixed problem with 'timeout'

Sidnei da Silva sidnei at enfoldsystems.com
Sun Oct 26 01:14:49 EDT 2008


Log message for revision 92571:
  - Launchpad #280334: Fixed problem with 'timeout'
    argument/attribute missing in testbrowser tests.
  
  

Changed:
  U   Zope/branches/gsoc-python-2.5/doc/CHANGES.txt
  U   Zope/branches/gsoc-python-2.5/lib/python/Products/Five/testbrowser.py

-=-
Modified: Zope/branches/gsoc-python-2.5/doc/CHANGES.txt
===================================================================
--- Zope/branches/gsoc-python-2.5/doc/CHANGES.txt	2008-10-26 00:38:25 UTC (rev 92570)
+++ Zope/branches/gsoc-python-2.5/doc/CHANGES.txt	2008-10-26 05:14:47 UTC (rev 92571)
@@ -198,6 +198,9 @@
 
     Bugs Fixed
 
+      - Launchpad #280334: Fixed problem with 'timeout'
+        argument/attribute missing in testbrowser tests.
+
       - Fixed against-the-rules zope.conf option 'fast_listen' to read
         'fast-listen' (dash, not underscore).
 

Modified: Zope/branches/gsoc-python-2.5/lib/python/Products/Five/testbrowser.py
===================================================================
--- Zope/branches/gsoc-python-2.5/lib/python/Products/Five/testbrowser.py	2008-10-26 00:38:25 UTC (rev 92570)
+++ Zope/branches/gsoc-python-2.5/lib/python/Products/Five/testbrowser.py	2008-10-26 05:14:47 UTC (rev 92571)
@@ -18,6 +18,8 @@
 $Id$
 """
 
+import sys
+import socket
 import urllib2
 
 import mechanize
@@ -29,7 +31,7 @@
 
 class PublisherConnection(testing.PublisherConnection):
 
-    def __init__(self, host):
+    def __init__(self, host, timeout=None):
         from Testing.ZopeTestCase.zopedoctest.functional import http
         self.caller = http
         self.host = host
@@ -76,6 +78,10 @@
     def http_open(self, req):
         """Open an HTTP connection having a ``urllib2`` request."""
         # Here we connect to the publisher.
+        if sys.version_info > (2, 6) and not hasattr(req, 'timeout'):
+            # Workaround mechanize incompatibility with Python
+            # 2.6. See: LP #280334
+            req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT
         return self.do_open(PublisherConnection, req)
 
 



More information about the Zope-Checkins mailing list