Commit 2ca28a5f authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

core: add handling for bytes file content in VersionedFiles

parent 6db0c2c7
......@@ -255,11 +255,12 @@ def create_versioned_file(filename, file_dir, file_contents):
full_path = os.path.join(file_dir, filename)
# Create file
fdest = VersionedFile(full_path, 'w')
if isinstance(file_contents, six.string_types):
fdest = VersionedFile(full_path, 'w')
fdest.write(file_contents)
elif isinstance(file_contents, (UploadedFile, InMemoryUploadedFile,
TemporaryUploadedFile, SimpleUploadedFile)):
TemporaryUploadedFile, SimpleUploadedFile, bytes)):
fdest = VersionedFile(full_path, 'wb')
for chunk in file_contents.chunks():
fdest.write(chunk)
fdest.close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment