[Zope3-checkins] CVS: Zope3/src/ZConfig - loader.py:1.21

Phillip J. Eby pje at telecommunity.com
Wed Sep 10 17:14:03 EDT 2003


Update of /cvs-repository/Zope3/src/ZConfig
In directory cvs.zope.org:/tmp/cvs-serv17207

Modified Files:
	loader.py 
Log Message:
Ensure that resources opened by ZConfig.loader are always closed.  (Only
BaseLoader.loadURL() was closing them previously.)


=== Zope3/src/ZConfig/loader.py 1.20 => 1.21 ===
--- Zope3/src/ZConfig/loader.py:1.20	Thu Jul 10 14:39:34 2003
+++ Zope3/src/ZConfig/loader.py	Wed Sep 10 16:14:01 2003
@@ -75,7 +75,10 @@
         if not url:
             url = _url_from_file(file)
         r = self.createResource(file, url)
-        return self.loadResource(r)
+        try:
+            return self.loadResource(r)
+        finally:
+            r.close()
 
     # utilities
 
@@ -196,7 +199,10 @@
     def includeConfiguration(self, section, url, defines):
         url = self.normalizeURL(url)
         r = self.openResource(url)
-        self._parse_resource(section, r, defines)
+        try:
+            self._parse_resource(section, r, defines)
+        finally:
+            r.close()
 
     # internal helper
 




More information about the Zope3-Checkins mailing list