[wwwsearch-commits] r19162 -
wwwsearch/ClientCookie/trunk/ClientCookie
jjlee at codespeak.net
jjlee at codespeak.net
Sat Oct 29 16:15:43 CEST 2005
Author: jjlee
Date: Sat Oct 29 16:15:42 2005
New Revision: 19162
Modified:
wwwsearch/ClientCookie/trunk/ClientCookie/_Util.py
Log:
Fix response_seek_wrapper to support the urllib2 response interface
Modified: wwwsearch/ClientCookie/trunk/ClientCookie/_Util.py
==============================================================================
--- wwwsearch/ClientCookie/trunk/ClientCookie/_Util.py (original)
+++ wwwsearch/ClientCookie/trunk/ClientCookie/_Util.py Sat Oct 29 16:15:42 2005
@@ -510,20 +510,39 @@
self.wrapped = None
class eoffile:
- # file-like object that always claims to be at end-of-file
+ # file-like object that always claims to be at end-of-file...
def read(self, size=-1): return ""
def readline(self, size=-1): return ""
+ # ...and also supports these response methods
+ def info(self):
+ return self.headers
+ def geturl(self):
+ return self.url
+
class response_seek_wrapper(seek_wrapper):
- """Avoids unnecessarily clobbering methods on .close().
+ """Avoids unnecessarily clobbering urllib.addinfourl methods on .close().
- Also supports pickling.
+ After .close():
+ , the following methods are supported:
- Class name is for historical reasons.
+ .read()
+ .readline()
+ .readlines()
+ .seek()
+ .tell()
+ .info()
+ .geturl()
+ .__iter__()
+ .next()
+
+ Also supports pickling.
"""
def close(self):
+ self.headers = self.wrapped.headers
+ self.url = self.wrapped.url
self.wrapped.close()
self.wrapped = eoffile()
More information about the wwwsearch-commits
mailing list