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

jjlee at codespeak.net jjlee at codespeak.net
Sat Mar 24 17:12:19 CET 2007


Author: jjlee
Date: Sat Mar 24 17:12:18 2007
New Revision: 41241

Modified:
   wwwsearch/mechanize/trunk/mechanize/_response.py
Log:
Remove a type test and add an assertion

Modified: wwwsearch/mechanize/trunk/mechanize/_response.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_response.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_response.py	Sat Mar 24 17:12:18 2007
@@ -414,7 +414,7 @@
     Accepts responses from both mechanize and urllib2 handlers.
     """
     if (isinstance(response, urllib2.HTTPError) and
-        not isinstance(response, response_seek_wrapper)):
+        not hasattr(response, "seek")):
         class httperror_seek_wrapper(response_seek_wrapper, response.__class__):
             # this only derives from HTTPError in order to be a subclass --
             # the HTTPError behaviour comes from delegation
@@ -440,6 +440,7 @@
     if hasattr(response, "closeable_response"):
         if not hasattr(response, "seek"):
             response = wrapper_class(response)
+        assert hasattr(response, "get_data")
         return copy.copy(response)
 
     # a urllib2 handler constructed the response, i.e. the response is an


More information about the wwwsearch-commits mailing list