Merge "Use a with block to create index.html."

This commit is contained in:
Jenkins 2014-02-12 19:09:14 +00:00 committed by Gerrit Code Review
commit aa04cf1614
1 changed files with 3 additions and 3 deletions

View File

@ -44,8 +44,8 @@ def create_report(out_dir, name_space={}):
prep_out_dir(out_dir)
out_file = open(os.path.join(out_dir, 'index.html'), "w")
out_file.write(str(t))
out_file.close()
with open(os.path.join(out_dir, 'index.html.tmp'), "w") as f:
f.write(str(t))
os.rename(f.name, os.path.join(out_dir, 'index.html'))
_create_json(out_dir, name_space=name_space)