[BUGFIX] Fix files written to citavi/ were empty.

This commit is contained in:
Jan Philipp Timme 2014-09-16 12:52:11 +02:00
parent 31bc03510d
commit 34d4226f2b
1 changed files with 3 additions and 3 deletions

View File

@ -129,10 +129,10 @@ class UpdateProjectView(ProtectedFormView, SingleObjectMixin):
""" This form_valid handles the file upload. """ """ This form_valid handles the file upload. """
original_file = form.files[u'file'] original_file = form.files[u'file']
original_filename = str(original_file) original_filename = str(original_file)
original_contentfile = ContentFile(original_file.read())
""" Put file into temporary folder for analysis """ """ Put file into temporary folder for analysis """
target_filename = 'tmp/project_' + str(self.project_id) + '.ctt4' target_filename = 'tmp/project_' + str(self.project_id) + '.ctt4'
relative_path = default_storage.save(target_filename, ContentFile(original_file.read())) relative_path = default_storage.save(target_filename, original_contentfile)
temp_sqlite = os.path.join(settings.MEDIA_ROOT, relative_path) temp_sqlite = os.path.join(settings.MEDIA_ROOT, relative_path)
""" Test if SQLite is a valid citavi project. """ """ Test if SQLite is a valid citavi project. """
@ -153,7 +153,7 @@ class UpdateProjectView(ProtectedFormView, SingleObjectMixin):
default_storage.delete(target_filename) default_storage.delete(target_filename)
""" Actually store file in citavi folder """ """ Actually store file in citavi folder """
relative_path = default_storage.save(target_filename, ContentFile(original_file.read())) relative_path = default_storage.save(target_filename, original_contentfile)
sqlite_path = os.path.join(settings.MEDIA_ROOT, relative_path) sqlite_path = os.path.join(settings.MEDIA_ROOT, relative_path)
""" Store new original filename in Project """ """ Store new original filename in Project """