Rev 5117: Fix compatibility with python2.7 for https. in file:///home/vila/src/bzr/bugs/693880-ssl-readline/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Dec 24 16:10:07 GMT 2010
At file:///home/vila/src/bzr/bugs/693880-ssl-readline/
------------------------------------------------------------
revno: 5117
revision-id: v.ladeuil+lp at free.fr-20101224161007-kyoqdozche3k92bs
parent: pqm at pqm.ubuntu.com-20101216172529-yqw26u9ufho22nes
fixes bug(s): https://launchpad.net/bugs/693880
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 693880-ssl-readline
timestamp: Fri 2010-12-24 17:10:07 +0100
message:
Fix compatibility with python2.7 for https.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2010-12-16 16:03:26 +0000
+++ b/NEWS 2010-12-24 16:10:07 +0000
@@ -32,6 +32,9 @@
because this can cause knock-on errors at awkward times.
(Andrew Bennetts, #687653)
+* ``https`` access works again with recent versions of python2.7.
+ (Vincent Ladeuil, #693880)
+
* RevisionTree.is_executable no longer returns None for directories and
symlinks. Instead, it returns False, like other Trees and methods.
(Aaron Bentley, #681885)
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py 2010-10-08 10:09:37 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py 2010-12-24 16:10:07 +0000
@@ -90,15 +90,16 @@
self.report_activity(len(s), 'read')
return s
- def readline(self):
- # This should be readline(self, size=-1), but httplib in python 2.4 and
- # 2.5 defines a SSLFile wrapper whose readline method lacks the size
- # parameter. So until we drop support for 2.4 and 2.5 and since we
- # don't *need* the size parameter we'll stay with readline(self)
- # -- vila 20090209
- s = self.filesock.readline()
- self.report_activity(len(s), 'read')
- return s
+ if sys.version < (2, 6):
+ def readline(self):
+ s = self.filesock.readline()
+ self.report_activity(len(s), 'read')
+ return s
+ else:
+ def readline(self, size=-1):
+ s = self.filesock.readline(size)
+ self.report_activity(len(s), 'read')
+ return s
def __getattr__(self, name):
return getattr(self.filesock, name)
More information about the bazaar-commits
mailing list