[wwwsearch-commits] r44828 - wwwsearch/mechanize/trunk/mechanize

jjlee at codespeak.net jjlee at codespeak.net
Sat Jul 7 18:47:34 CEST 2007


Author: jjlee
Date: Sat Jul  7 18:47:34 2007
New Revision: 44828

Modified:
   wwwsearch/mechanize/trunk/mechanize/_useragent.py
Log:
Change default mechanize.UserAgent (hence mechanize.Browser) Refresh behaviour:
 * Don't follow Refreshes > 30 seconds
 * honor_time is now False by default

This is a backwards-incompatible change.  The old default behaviour was confusing and rarely useful.

You can get behaviour the same as the old defaults like so:

browser.set_handle_refresh(True, max_time=None, honor_time=True)


Modified: wwwsearch/mechanize/trunk/mechanize/_useragent.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_useragent.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_useragent.py	Sat Jul  7 18:47:34 2007
@@ -229,7 +229,7 @@
     def set_handle_redirect(self, handle):
         """Set whether to handle HTTP 30x redirections."""
         self._set_handler("_redirect", handle)
-    def set_handle_refresh(self, handle, max_time=None, honor_time=True):
+    def set_handle_refresh(self, handle, max_time=30.0, honor_time=False):
         """Set whether to handle HTTP Refresh headers."""
         self._set_handler("_refresh", handle, constructor_kwds=
                           {"max_time": max_time, "honor_time": honor_time})


More information about the wwwsearch-commits mailing list