Show More
@@ -32,11 +32,7 class httprangereader(object): | |||||
32 | try: |
|
32 | try: | |
33 | f = self.opener.open(req) |
|
33 | f = self.opener.open(req) | |
34 | data = f.read() |
|
34 | data = f.read() | |
35 | # Python 2.6+ defines a getcode() function, and 2.4 and |
|
35 | code = f.code | |
36 | # 2.5 appear to always have an undocumented code attribute |
|
|||
37 | # set. If we can't read either of those, fall back to 206 |
|
|||
38 | # and hope for the best. |
|
|||
39 | code = getattr(f, 'getcode', lambda : getattr(f, 'code', 206))() |
|
|||
40 | except urllib2.HTTPError, inst: |
|
36 | except urllib2.HTTPError, inst: | |
41 | num = inst.code == 404 and errno.ENOENT or None |
|
37 | num = inst.code == 404 and errno.ENOENT or None | |
42 | raise IOError(num, inst) |
|
38 | raise IOError(num, inst) |
General Comments 0
You need to be logged in to leave comments.
Login now