Ticket #15644: django.core.files.base.File.diff
File django.core.files.base.File.diff, 911 bytes (added by , 14 years ago) |
---|
-
django/core/files/base.py
36 36 if not hasattr(self, '_size'): 37 37 if hasattr(self.file, 'size'): 38 38 self._size = self.file.size 39 elif os.path.exists(self.file.name):39 elif hasattr(self.file, 'name') and os.path.exists(self.file.name): 40 40 self._size = os.path.getsize(self.file.name) 41 elif hasattr(self.file, 'tell') and hasattr(self.file, 'seek'): 42 pos = self.file.tell() 43 self.file.seek(0,os.SEEK_END) 44 self._size = self.file.tell() 45 self.file.seek(pos) 41 46 else: 42 47 raise AttributeError("Unable to determine the file's size.") 43 48 return self._size