[CMF-checkins] CVS: CMF/CMFCore - FSMetadata.py:1.5

Andy McKay andy@agmweb.ca
Fri, 23 May 2003 21:13:00 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv10891

Modified Files:
	FSMetadata.py 
Log Message:
I cant remember where the collector is, so here's the problem. If there is a problem parsing a metadata file then an error is raised. Unfortunately because upstream of the metadata parsing there is a bare try and except no-one is notified and a whole directory can be ignored.

This patch makes sure that the files continue to be parsed, and more importantly tells the user there is an error.


=== CMF/CMFCore/FSMetadata.py 1.4 => 1.5 ===
--- CMF/CMFCore/FSMetadata.py:1.4	Mon Mar 24 00:12:27 2003
+++ CMF/CMFCore/FSMetadata.py	Fri May 23 21:12:59 2003
@@ -65,12 +65,22 @@
     # private API
     def _readMetadata(self):
         """ Read the new file format using ConfigParser """
-        cfg = CMFConfigParser()
-        cfg.read(self._filename + '.metadata')
+        self._properties = {}
+        self._security = {}
+        
+        try:
+            cfg = CMFConfigParser()
+            cfg.read(self._filename + '.metadata')
 
-        # the two sections we care about
-        self._properties = self._getSectionDict(cfg, 'default')
-        self._security = self._getSectionDict(cfg, 'security', self._securityParser)
+            # the two sections we care about
+            self._properties = self._getSectionDict(cfg, 'default')
+            self._security = self._getSectionDict(cfg, 'security', self._securityParser)
+        except:
+            LOG('FSMetadata',
+                 ERROR,
+                'Error parsing .metadata file',
+                 error=exc_info())
+        
         # to add in a new value such as proxy roles,
         # just add in the section, call it using getSectionDict
         # if you need a special parser for some whacky