[Zope-CMF] Re: [CMF-checkins] CVS: CMF/CMFCore - FSMetadata.py:1.2

Chris Withers chrisw@nipltd.com
Mon, 17 Mar 2003 08:40:23 +0000


Andy McKay wrote:
> Update of /cvs-repository/CMF/CMFCore
> In directory cvs.zope.org:/tmp/cvs-serv1679
> 
> Modified Files:
> 	FSMetadata.py 
> Log Message:
> Replace greedy except pass with something better and remove string imports
> 
> 
> === CMF/CMFCore/FSMetadata.py 1.1 => 1.2 ===
> --- CMF/CMFCore/FSMetadata.py:1.1	Wed Mar 12 00:06:28 2003
> +++ CMF/CMFCore/FSMetadata.py	Fri Mar 14 12:38:49 2003
> @@ -130,10 +130,9 @@
>              f.close()
>              props = {}
>              for line in lines:
> -                try: key, value = split(line, '=',1)
> -                except: pass
> -                else:
> -                    props[strip(key)] = strip(value)
> +                kv = line.split('=', 1)
> +                if len(kv) == 2:
> +                    props[kv[0].strip()] = kv[1].strip()
>              return props

Sould there maybe be an 'else' clause in there?

cheers,

Chris