[Zope3-checkins] CVS: Zope3 - z3.py:1.14

Anthony Baxter anthony@interlink.com.au
Thu, 9 Jan 2003 03:48:36 -0500


Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv23868

Modified Files:
	z3.py 
Log Message:
Richard noticed that z3.py relies on implicit close() of files. 
Changed to be explicit, and demonstrate good coding practice.


=== Zope3/z3.py 1.13 => 1.14 ===
--- Zope3/z3.py:1.13	Wed Dec 25 14:28:50 2002
+++ Zope3/z3.py	Thu Jan  9 03:48:33 2003
@@ -54,7 +54,10 @@
     if (not os.path.exists('products.zcml')
         and os.path.exists('products.zcml.in')
         ):
-        open('products.zcml', 'w').write(open('products.zcml.in').read())
+        cfin = open('products.zcml.in')
+        cfout = open('products.zcml', 'w')
+        cfout.write(cfin.read())
+        cfout.close(); cfin.close()
 
     # Do global software config
     from zope.app import config
@@ -64,7 +67,10 @@
     if (not os.path.exists('zserver.zcml')
         and os.path.exists('zserver.zcml.in')
         ):
-        open('zserver.zcml', 'w').write(open('zserver.zcml.in').read())
+        cfin = open('zserver.zcml.in')
+        cfout = open('zserver.zcml', 'w')
+        cfout.write(cfin.read())
+        cfout.close(); cfin.close()
 
     from zope.configuration.xmlconfig import XMLConfig
     XMLConfig(os.path.join(dir, 'zserver.zcml'))()