﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7683	Streaming Upload file deleted before move	emperorcezar	nobody	"In /django/db/models/base.py on line 532 it's calling raw_field.close() before it tries moving the file and that's causing the following traceback.

raw_field.close() is deleting the temp file before it gets a chance to be moved.

{{{
Environment:

Request Method: POST
Request URL: http://localhost:8000/essayupload/
Django Version: 0.97-pre-SVN-7870
Python Version: 2.5.2
Installed Applications:
['appid.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'appid.apply',
 'django.contrib.admin',
 'registration',
 'extensions']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'appid.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.locale.LocaleMiddleware')


Traceback:
File ""/usr/lib/python2.5/site-packages/django/core/handlers/base.py"" in get_response
  86.                 response = callback(request, *callback_args, **callback_kwargs)
File ""/usr/lib/python2.5/site-packages/django/contrib/auth/decorators.py"" in __call__
  67.             return self.view_func(request, *args, **kwargs)
File ""/home/cezar/code/appid/apply/views.py"" in essayUpload
  316.             object = form.save(commit=False)
File ""/usr/lib/python2.5/site-packages/django/newforms/models.py"" in save
  273.         return save_instance(self, self.instance, self._meta.fields, fail_message, commit)
File ""/usr/lib/python2.5/site-packages/django/newforms/models.py"" in save_instance
  44.         f.save_form_data(instance, cleaned_data[f.name])
File ""/usr/lib/python2.5/site-packages/django/db/models/fields/__init__.py"" in save_form_data
  865.             getattr(instance, ""save_%s_file"" % self.name)(data.name, data, save=False)
File ""/usr/lib/python2.5/site-packages/django/db/models/fields/__init__.py"" in <lambda>
  817.         setattr(cls, 'save_%s_file' % self.name, lambda instance, filename, raw_field, save=True: instance._save_FIELD_file(self, filename, raw_field, save))
File ""/usr/lib/python2.5/site-packages/django/db/models/base.py"" in _save_FIELD_file
  533.             file_move_safe(raw_field.temporary_file_path(), full_filename)
File ""/usr/lib/python2.5/site-packages/django/core/files/move.py"" in file_move_safe
  40.         file_move(old_file_name, new_file_name)
File ""/usr/lib/python2.5/shutil.py"" in move
  199.             copy2(src,dst)
File ""/usr/lib/python2.5/shutil.py"" in copy2
  91.     copyfile(src, dst)
File ""/usr/lib/python2.5/shutil.py"" in copyfile
  46.         fsrc = open(src, 'rb')

Exception Type: IOError at /essayupload/
Exception Value: [Errno 2] No such file or directory: u'02-heaven_on_their_minds_192_ogg_cbr_ex.ogg'
}}}"		closed	Core (Other)	dev		fixed	2070-fix	emperorcezar@… prigun@… screeley@… sebastian@… django@… dcwatson@… donspauldingii@…	Ready for checkin	1	0	0	0	0	0
