[Zodb-checkins] CVS: Zope/lib/python/ZODB - StorageTypes.py:1.1.2.2

Chris McDonough chrism@zope.com
25 Nov 2002 09:56:20 -0500


This was sort of a band-aid for a particular case I was seeing.  It
needn't stay.  I think the fact that we don't provide sensible error
messages when the constructor fails (due to a typo in the config, a
missing value, etc) needs to be dealt with a separate way.  IMO, we
don't actually want to call the constructor unless we know we have
sensible arguments to give to it.  Instead it should fail and tell the
person the line number of the config file that is wrong.

On Mon, 2002-11-25 at 08:12, Guido van Rossum wrote:
> > Log Message:
> > Make database sections work properly.
> > 
> > 
> > === Zope/lib/python/ZODB/StorageTypes.py 1.1.2.1 => 1.1.2.2 ===
> > --- Zope/lib/python/ZODB/StorageTypes.py:1.1.2.1	Sun Nov 24 19:10:13 2002
> > +++ Zope/lib/python/ZODB/StorageTypes.py	Mon Nov 25 03:42:24 2002
> > @@ -43,6 +43,9 @@
> >          if kw.has_key(name):
> >              kw[name] = asBoolean(kw[name])
> >  
> > +    if not kw.has_key('file_name'):
> > +        raise RuntimeError, 'A file_name argument is required for FileStorage'
> > +
> >      return kw
> 
> Chris, can you explain the need for this?  In general, missing
> arguments simply cause the constructor to fail.  Why isn't that enough
> for FileStorage?  (IOW, what's your use case for this change?)
> 
> --Guido van Rossum (home page: http://www.python.org/~guido/)