Update admin.py
This commit is contained in:
1 parent
43df53adaf
commit
02a32f1c02
1 file changed
+2
-2
@@ -676,8 +676,8 @@ class FPSProblemImport(CSRFExemptAPIView):
|
|||||||
with tempfile.NamedTemporaryFile("wb") as tf:
|
with tempfile.NamedTemporaryFile("wb") as tf:
|
||||||
for chunk in file.chunks(4096):
|
for chunk in file.chunks(4096):
|
||||||
tf.file.write(chunk)
|
tf.file.write(chunk)
|
||||||
tf.file.flush() #确保file写入tf成功
|
tf.file.flush()
|
||||||
os.fsync(tf.file) #确保file写入tf成功
|
os.fsync(tf.file)
|
||||||
problems = FPSParser(tf.name).parse()
|
problems = FPSParser(tf.name).parse()
|
||||||
else:
|
else:
|
||||||
return self.error("Parse upload file error")
|
return self.error("Parse upload file error")
|
||||||
|
|||||||
Reference in new issue
Block a user