Ticket #7683: 7683.3.diff
File 7683.3.diff, 1.8 KB (added by , 16 years ago) |
---|
-
django/db/models/base.py
527 527 full_filename = self._get_FIELD_filename(field) 528 528 if hasattr(raw_field, 'temporary_file_path'): 529 529 # This file has a file path that we can move. 530 file_move_safe(raw_field.temporary_file_path(), full_filename) 530 531 raw_field.close() 531 file_move_safe(raw_field.temporary_file_path(), full_filename)532 532 else: 533 533 # This is a normal uploadedfile that we can stream. 534 534 fp = open(full_filename, 'wb') -
django/core/files/uploadedfile.py
201 201 def read(self, *args): return self._file.read(*args) 202 202 def seek(self, offset): return self._file.seek(offset) 203 203 def write(self, s): return self._file.write(s) 204 def close(self): return self._file.close()205 204 def __iter__(self): return iter(self._file) 206 205 def readlines(self, size=None): return self._file.readlines(size) 207 206 def xreadlines(self): return self._file.xreadlines() 208 207 def close(self): 208 try: 209 return self._file.close() 210 except: 211 # Means the file was moved or deleted before the tempfile could unlink it. 212 # Still sets self._file.close_called and calls self._file.file.close() 213 # before the exception 214 return 215 209 216 class InMemoryUploadedFile(UploadedFile): 210 217 """ 211 218 A file uploaded into memory (i.e. stream-to-memory).