read write file, small fix

This commit is contained in:
crunk 2022-03-19 20:01:31 +01:00
parent d5369bc142
commit a11a263878

View File

@ -58,10 +58,12 @@ def SaveUploadCssFile(editorform, newcssfolder):
cssfile = editorform.cssfile.data cssfile = editorform.cssfile.data
cssfilename = f"{secure_filename(editorform.cssname.data)}.css" cssfilename = f"{secure_filename(editorform.cssname.data)}.css"
cssfile.save(os.path.join(newcssfolder, cssfilename)) cssfile.save(os.path.join(newcssfolder, cssfilename))
openfile = open(os.path.join(newcssfolder, cssfilename), 'r+') openfile = open(os.path.join(newcssfolder, cssfilename), 'r')
cleancss = bleach.clean(openfile.read()) cleancss = bleach.clean(openfile.read())
openfile.write(cleancss) openfile.close()
openfile.close cleanfile = open(os.path.join(newcssfolder, cssfilename), 'w')
cleanfile.write(cleancss)
cleanfile.close()
def WriteCssToFile(editorform, newcssfolder): def WriteCssToFile(editorform, newcssfolder):