← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-apidoc-index-generation into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-apidoc-index-generation into launchpad:master.

Commit message:
Fix unclosed file while writing the apidoc index

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/429699
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-apidoc-index-generation into launchpad:master.
diff --git a/utilities/create-lp-wadl-and-apidoc.py b/utilities/create-lp-wadl-and-apidoc.py
index 9bd13d8..216db32 100755
--- a/utilities/create-lp-wadl-and-apidoc.py
+++ b/utilities/create-lp-wadl-and-apidoc.py
@@ -133,8 +133,8 @@ def main(directory, force=False):
     template = PageTemplateFile(template_file)
     index_filename = os.path.join(directory, "index.html")
     print("Writing index:", index_filename)
-    f = open(index_filename, "w")
-    f.write(template(config=config))
+    with open(index_filename, "w") as f:
+        f.write(template(config=config))
 
     # Get the time of the last commit.  We will use this as the mtime for the
     # generated files so that we can safely use it as part of Apache's etag