mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-27 15:41:58 +00:00
fix flake8 standard problems
This commit is contained in:
parent
3754fa2542
commit
d4b3a42f94
@ -151,7 +151,7 @@ class GenerateUserAPI(APIView):
|
||||
raw_data = f.read()
|
||||
os.remove(file_path)
|
||||
response = HttpResponse(raw_data)
|
||||
response["Content-Disposition"] = f"attachment; filename=users.xlsx"
|
||||
response["Content-Disposition"] = "attachment; filename=users.xlsx"
|
||||
response["Content-Type"] = "application/xlsx"
|
||||
return response
|
||||
|
||||
|
@ -305,7 +305,7 @@ class ApplyResetPasswordAPI(APIView):
|
||||
send_email_async.send(from_name=SysOptions.website_name_shortcut,
|
||||
to_email=user.email,
|
||||
to_name=user.username,
|
||||
subject=f"Reset your password",
|
||||
subject="Reset your password",
|
||||
content=email_html)
|
||||
return self.success("Succeeded")
|
||||
|
||||
|
@ -71,7 +71,7 @@ class WebsiteConfigAPITest(APITestCase):
|
||||
"allow_register": True, "submission_list_show_all": False}
|
||||
resp = self.client.post(url, data=data)
|
||||
self.assertSuccess(resp)
|
||||
self.assertEqual(SysOptions.website_footer, "<img src=\"#\" />")
|
||||
self.assertEqual(SysOptions.website_footer, '<img src=\"#\" />')
|
||||
|
||||
def test_get_website_config(self):
|
||||
# do not need to login
|
||||
|
@ -542,7 +542,7 @@ class ExportProblemAPI(APIView):
|
||||
delete_files.send_with_options(args=(path,), delay=300_000)
|
||||
resp = FileResponse(open(path, "rb"))
|
||||
resp["Content-Type"] = "application/zip"
|
||||
resp["Content-Disposition"] = f"attachment;filename=problem-export.zip"
|
||||
resp["Content-Disposition"] = "attachment;filename=problem-export.zip"
|
||||
return resp
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@ print("running flake8...")
|
||||
if os.system("flake8 --statistics ."):
|
||||
exit()
|
||||
|
||||
ret = os.system("coverage run --include=\"$PWD/*\" manage.py test {module} --settings={setting}".format(module=test_module, setting=setting))
|
||||
ret = os.system('coverage run --include=\"$PWD/*\" manage.py test {module} --settings={setting}'.format(module=test_module, setting=setting))
|
||||
|
||||
if not ret and is_coverage:
|
||||
os.system("coverage html && open htmlcov/index.html")
|
||||
|
@ -36,7 +36,7 @@ class Command(BaseCommand):
|
||||
user = User.objects.get(username=username)
|
||||
user.set_password(password)
|
||||
user.save()
|
||||
self.stdout.write(self.style.SUCCESS(f"Password is rested"))
|
||||
self.stdout.write(self.style.SUCCESS("Password is rested"))
|
||||
except User.DoesNotExist:
|
||||
self.stdout.write(self.style.ERROR(f"User {username} doesnot exist, operation ignored"))
|
||||
exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user