##// END OF EJS Templates
byterange: replace uses of hasattr with getattr
Augie Fackler -
r14947:3aa34005 default
parent child Browse files
Show More
@@ -103,9 +103,7 b' class RangeableFileObject(object):'
103 103 """This effectively allows us to wrap at the instance level.
104 104 Any attribute not found in _this_ object will be searched for
105 105 in self.fo. This includes methods."""
106 if hasattr(self.fo, name):
107 return getattr(self.fo, name)
108 raise AttributeError(name)
106 return getattr(self.fo, name)
109 107
110 108 def tell(self):
111 109 """Return the position within the range.
@@ -170,10 +168,8 b' class RangeableFileObject(object):'
170 168 offset is relative to the current position (self.realpos).
171 169 """
172 170 assert offset >= 0
173 if not hasattr(self.fo, 'seek'):
174 self._poor_mans_seek(offset)
175 else:
176 self.fo.seek(self.realpos + offset)
171 seek = getattr(self.fo, 'seek', self._poor_mans_seek)
172 seek(self.realpos + offset)
177 173 self.realpos += offset
178 174
179 175 def _poor_mans_seek(self, offset):
General Comments 0
You need to be logged in to leave comments. Login now