forked from github/pelican
Use the with statement when opening files.
This commit is contained in:
parent
0298d412dc
commit
df25dec30a
2 changed files with 11 additions and 10 deletions
|
|
@ -375,7 +375,8 @@ class PdfGenerator(Generator):
|
|||
filename = obj.slug + ".pdf"
|
||||
output_pdf=os.path.join(output_path, filename)
|
||||
# print "Generating pdf for", obj.filename, " in ", output_pdf
|
||||
self.pdfcreator.createPdf(text=open(obj.filename), output=output_pdf)
|
||||
with open(obj.filename) as f:
|
||||
self.pdfcreator.createPdf(text=f, output=output_pdf)
|
||||
info(u' [ok] writing %s' % output_pdf)
|
||||
|
||||
def generate_context(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue