Merge branch 'for-contest' of https://git.coding.net/virusdefender/qduoj into for-contest-dev

This commit is contained in:
hohoTT
2015-09-05 11:45:22 +08:00
3 changed files with 10 additions and 7 deletions

View File

@@ -185,8 +185,12 @@ class TestCaseUploadAPIView(APIView):
os.mkdir(test_case_dir)
for name in l:
f = open(test_case_dir + name, "wb")
f.write(test_case_file.read(name).replace("\r\n", "\n"))
f.close()
try:
f.write(test_case_file.read(name).replace("\r\n", "\n"))
except MemoryError:
return error_response(u"单个测试数据体积过大!")
finally:
f.close()
l.sort()
file_info = {"test_case_number": len(l) / 2, "test_cases": {}}