From 34d4226f2b4d3e7a08292d6974cfc45513c538a4 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 16 Sep 2014 12:52:11 +0200 Subject: [PATCH] [BUGFIX] Fix files written to citavi/ were empty. --- frontend/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/views.py b/frontend/views.py index e24a544..627bab1 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -129,10 +129,10 @@ class UpdateProjectView(ProtectedFormView, SingleObjectMixin): """ This form_valid handles the file upload. """ original_file = form.files[u'file'] original_filename = str(original_file) - + original_contentfile = ContentFile(original_file.read()) """ Put file into temporary folder for analysis """ 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) """ Test if SQLite is a valid citavi project. """ @@ -153,7 +153,7 @@ class UpdateProjectView(ProtectedFormView, SingleObjectMixin): default_storage.delete(target_filename) """ 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) """ Store new original filename in Project """