/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_urllib2_wrappers.py

  • Committer: John Arbash Meinel
  • Date: 2011-01-10 22:20:12 UTC
  • mfrom: (5582 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5599.
  • Revision ID: john@arbash-meinel.com-20110110222012-mtcqudkvmzwiufuc
Merge in the bzr.dev 5582

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
110
110
        self.report_activity(len(s), 'read')
111
111
        return s
112
112
 
113
 
    def readline(self):
114
 
        # This should be readline(self, size=-1), but httplib in python 2.4 and
115
 
        #  2.5 defines a SSLFile wrapper whose readline method lacks the size
116
 
        #  parameter.  So until we drop support for 2.4 and 2.5 and since we
117
 
        #  don't *need* the size parameter we'll stay with readline(self)
118
 
        #  --  vila 20090209
119
 
        s = self.filesock.readline()
120
 
        self.report_activity(len(s), 'read')
121
 
        return s
 
113
    # httplib in python 2.4 and 2.5 defines a SSLFile wrapper whose readline
 
114
    # method lacks the size parameter. python2.6 provides a proper ssl socket
 
115
    # and added it. python2.7 uses it, forcing us to provide it.
 
116
    if sys.version_info < (2, 6):
 
117
        def readline(self):
 
118
            s = self.filesock.readline()
 
119
            self.report_activity(len(s), 'read')
 
120
            return s
 
121
    else:
 
122
        def readline(self, size=-1):
 
123
            s = self.filesock.readline(size)
 
124
            self.report_activity(len(s), 'read')
 
125
            return s
122
126
 
123
127
    def __getattr__(self, name):
124
128
        return getattr(self.filesock, name)