On Tuesday 24 July 2007 7:28:59 pm Fernando Perez wrote:
> On 7/24/07, Darren Dale <[EMAIL PROTECTED]> wrote:
[...]
> > Would it be possible to provide some more context for bad
> > sections or keys? 
[...]
> now the exception message reads:
>
>
> TConfigInvalidKeyError: ConfigObj with filename: 'mplrc.conf'
> Contains the following invalid keys: ['bogus']
> The valid keys for this section are: ['maskedarray', 'datapath',
> 'numerix', 'timezone', 'toolbar', 'interactive']
>
> and similarly for invalid sections.  At least with the filename and
> the list of bad/good values, people should be able to fend for
> themselves.  If not, let them use matlab :)

:) That should be plenty of information. One comment: if you load mplrc2.conf, 
which includes an mplrc.conf with a bogus key, the error indicates the bad 
key is in mplrc2.conf. Is that a concern? 

> Please update and let me know what happens.
>
> > It might be nice to be able to deprecate keys
[...]
> when you deprecate a Key, simply change it from
>
> class Foo(TConfig):
>   somekey = T.Int
>
> to
>
>   somekey = DeprecatedKey
>
> where DeprecatedKey is a Trait you declare, whose handler/validator
> provides the necessary information to the user, sends warnings, it can
> even set the proper value in the new form of that information if it
> makes sense, etc.

Great!

> > Raising an error for
> > unrecognized keys might be too extreme. Maybe TConfig should have a
> > raiseOnKeyError option, so that bad values can be reported with a warning
> > instead, and the end user can get up and running without fixing it right
> > away.

This seemed an important point to me at first. But with well-documented, 
auto-generated examples, creating minimal examples or stubs in 
users .matplotlib or .ipython dirs, and a good mechanism for key deprecation, 
now I dont think it will be a big deal to raise errors on bad keys. It should 
be extremely rare.

Darren

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to