fix(pdf): Cleanup temporary files after pdf generation

This was removed in https://github.com/frappe/frappe/pull/7358
This commit is contained in:
Aditya Hase 2020-09-09 20:52:45 +05:30
parent 308302697d
commit 8feba5fa9b
No known key found for this signature in database
GPG key ID: 0A55F0FCA0234972

View file

@ -52,6 +52,8 @@ def get_pdf(html, options=None, output=None):
output.appendPagesFromReader(reader)
else:
raise
finally:
cleanup(options)
if "password" in options:
password = options["password"]
@ -184,10 +186,7 @@ def prepare_header_footer(soup):
return options
def cleanup(fname, options):
if os.path.exists(fname):
os.remove(fname)
def cleanup(options):
for key in ("header-html", "footer-html"):
if options.get(key) and os.path.exists(options[key]):
os.remove(options[key])