[Zope-Checkins] SVN: Zope/branches/2.12/ Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.

Wichert Akkerman wichert at wiggy.net
Fri May 28 11:42:06 EDT 2010


Log message for revision 112803:
  Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/Products/Five/testbrowser.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst	2010-05-28 15:31:11 UTC (rev 112802)
+++ Zope/branches/2.12/doc/CHANGES.rst	2010-05-28 15:42:05 UTC (rev 112803)
@@ -11,6 +11,8 @@
 Bugs Fixed
 ++++++++++
 
+- Update Five's testbrowser to support both mechanize 0.1.x and 0.2.x.
+
 - Five's processInputs() would stomp on :list or :tuple values that contained
   ints or other non-strings, would clear out :records entirely, and would not
   do anything for :record fields.

Modified: Zope/branches/2.12/src/Products/Five/testbrowser.py
===================================================================
--- Zope/branches/2.12/src/Products/Five/testbrowser.py	2010-05-28 15:31:11 UTC (rev 112802)
+++ Zope/branches/2.12/src/Products/Five/testbrowser.py	2010-05-28 15:42:05 UTC (rev 112803)
@@ -95,15 +95,10 @@
                         '_equiv', '_basicauth', '_digestauth' ]
 
     def __init__(self, *args, **kws):
-        inherited_handlers = ['_unknown', '_http_error',
-            '_http_request_upgrade', '_http_default_error', '_basicauth',
-            '_digestauth', '_redirect', '_cookies', '_referer',
-            '_refresh', '_equiv', '_gzip']
-
-        self.handler_classes = {"http": PublisherHTTPHandler}
-        for name in inherited_handlers:
-            self.handler_classes[name] = mechanize.Browser.handler_classes[name]
-
+        self.handler_classes = mechanize.Browser.handler_classes.copy()
+        self.handler_classes["http"] = PublisherHTTPHandler
+        self.default_others = [cls for cls in self.default_others 
+                               if cls in mechanize.Browser.handler_classes]
         mechanize.Browser.__init__(self, *args, **kws)
 
 



More information about the Zope-Checkins mailing list