server/serverconfig.py
changeset 10818 8cdf9965b2b8
parent 10793 8316fdad9987
--- a/server/serverconfig.py	Mon Oct 19 14:29:53 2015 +0200
+++ b/server/serverconfig.py	Mon Oct 19 17:53:51 2015 +0200
@@ -236,15 +236,16 @@
 
     def bootstrap_cubes(self):
         from logilab.common.textutils import splitstrip
-        for line in open(join(self.apphome, 'bootstrap_cubes')):
-            line = line.strip()
-            if not line or line.startswith('#'):
-                continue
-            self.init_cubes(self.expand_cubes(splitstrip(line)))
-            break
-        else:
-            # no cubes
-            self.init_cubes(())
+        with open(join(self.apphome, 'bootstrap_cubes')) as f:
+            for line in f:
+                line = line.strip()
+                if not line or line.startswith('#'):
+                    continue
+                self.init_cubes(self.expand_cubes(splitstrip(line)))
+                break
+            else:
+                # no cubes
+                self.init_cubes(())
 
     def write_bootstrap_cubes_file(self, cubes):
         stream = open(join(self.apphome, 'bootstrap_cubes'), 'w')