]> git.pld-linux.org Git - packages/bzr.git/blob - py27.patch
- up to 2.2.3
[packages/bzr.git] / py27.patch
1 === modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
2 --- bzrlib/transport/http/_urllib2_wrappers.py  2010-05-08 05:56:28 +0000
3 +++ bzrlib/transport/http/_urllib2_wrappers.py  2010-09-15 02:43:44 +0000
4 @@ -75,6 +75,26 @@
5      )
6  
7  
8 +class addinfourl(urllib2.addinfourl):
9 +    '''Replacement addinfourl class compatible with python-2.7's xmlrpclib
10 +
11 +    In python-2.7, xmlrpclib expects that the response object that it receives
12 +    has a getheader method.  httplib.HTTPResponse provides this but
13 +    urllib2.addinfourl does not.  Add the necessary functions here, ported to
14 +    use the internal data structures of addinfourl.
15 +    '''
16 +
17 +    def getheader(self, name, default=None):
18 +        if self.headers is None:
19 +            raise httplib.ResponseNotReady()
20 +        return self.headers.getheader(name, default)
21 +
22 +    def getheaders(self):
23 +        if self.headers is None:
24 +            raise httplib.ResponseNotReady()
25 +        return self.headers.items()
26 +
27 +
28  class _ReportingFileSocket(object):
29  
30      def __init__(self, filesock, report_activity=None):
31 @@ -656,7 +676,7 @@
32              r = response
33              r.recv = r.read
34              fp = socket._fileobject(r, bufsize=65536)
35 -            resp = urllib2.addinfourl(fp, r.msg, req.get_full_url())
36 +            resp = addinfourl(fp, r.msg, req.get_full_url())
37              resp.code = r.status
38              resp.msg = r.reason
39              resp.version = r.version
40
This page took 0.10065 seconds and 3 git commands to generate.