diff --git a/dojo/management/commands/import_surveys.py b/dojo/management/commands/import_surveys.py index d1577648806..ad8f2c8648a 100644 --- a/dojo/management/commands/import_surveys.py +++ b/dojo/management/commands/import_surveys.py @@ -39,7 +39,6 @@ def handle(self, *args, **options): new_line = matchedLine.replace(old_id, str(ctype_id)) # Replace the all lines in the file with open(path, "w", encoding="utf-8") as fout: - for line in contents: - fout.write(line.replace(matchedLine, new_line)) + fout.writelines(line.replace(matchedLine, new_line) for line in contents) # Delete the temp question created_question.delete() diff --git a/dojo/tools/mobsf/parser.py b/dojo/tools/mobsf/parser.py index 8cbc98cc54d..adcabbe25eb 100644 --- a/dojo/tools/mobsf/parser.py +++ b/dojo/tools/mobsf/parser.py @@ -148,8 +148,6 @@ def get_findings(self, filename, test): "file_path": None, } mobsf_findings.append(mobsf_item) - else: - pass # Manifest Analysis if "manifest_analysis" in data: diff --git a/dojo/utils.py b/dojo/utils.py index 206d561151e..240bf23c2f3 100644 --- a/dojo/utils.py +++ b/dojo/utils.py @@ -1379,8 +1379,7 @@ def handle_uploaded_threat(f, eng): Path(settings.MEDIA_ROOT + "/threat/").mkdir() with open(settings.MEDIA_ROOT + f"/threat/{eng.id}{extension}", "wb+") as destination: - for chunk in f.chunks(): - destination.write(chunk) + destination.writelines(chunk for chunk in f.chunks()) eng.tmodel_path = settings.MEDIA_ROOT + f"/threat/{eng.id}{extension}" eng.save() @@ -1390,8 +1389,7 @@ def handle_uploaded_selenium(f, cred): extension = path.suffix with open(settings.MEDIA_ROOT + f"/selenium/{cred.id}{extension}", "wb+") as destination: - for chunk in f.chunks(): - destination.write(chunk) + destination.writelines(chunk for chunk in f.chunks()) cred.selenium_script = settings.MEDIA_ROOT + f"/selenium/{cred.id}{extension}" cred.save()