fix(pdf): Cleanup temporary files after pdf generation
This was removed in https://github.com/frappe/frappe/pull/7358
This commit is contained in:
parent
308302697d
commit
8feba5fa9b
1 changed files with 3 additions and 4 deletions
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue