[Zope-CMF] Re: [CMF-checkins] CVS: CMF/CMFCore - FSMetadata.py:1.5
Florent Guillaume
fg@nuxeo.com
Mon, 23 Jun 2003 17:42:41 +0200
Could you tell us where is the above bare except: so that we fix it?
Also, why did you add another bare except:? Surely only specific
exceptions are useful.
By the way, the cmf collector is at http://collector.zope.org/CMF
(google also knows it).
Florent
In article <200305240113.h4O1D0g11276@cvs.baymountain.com> you write:
> 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
>
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com