This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jjdominguezm
Recipients jjdominguezm
Date 2009-08-21.08:57:55
SpamBayes Score 5.451465e-09
Marked as misclassified No
Message-id <1250845077.86.0.224640008074.issue6751@psf.upfronthosting.co.za>
In-reply-to
Content
I think it is useful, at least for me, to add an argument, default, to
[Safe,Raw]ConfigParser.get that, if present, will be returned if the
methid fails to return the value.

That is, instead of rasing an exception, return default, if present.

It could be done overriding the get method in SafeConfigParser,
something like this:

class SafeConfigParser(ConfigParser):
    def get(self, section, option, raw=False, vars=None, **kwds):
        try:
            return super().get(section, option, raw, vars)
        except Exception as exc:
            if "default" in kwds:
                return kwds["default"]
            raise exc
History
Date User Action Args
2009-08-21 08:57:57jjdominguezmsetrecipients: + jjdominguezm
2009-08-21 08:57:57jjdominguezmsetmessageid: <1250845077.86.0.224640008074.issue6751@psf.upfronthosting.co.za>
2009-08-21 08:57:56jjdominguezmlinkissue6751 messages
2009-08-21 08:57:55jjdominguezmcreate