Closed Bug 675105 Opened 13 years ago Closed 12 years ago

Config.get() should accept an optional default value

Categories

(Cloud Services :: Server: Core, defect)

x86
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jrconlin, Unassigned)

Details

(Whiteboard: [qa-])

Currently services-core.services.config.Config.get(section, item) does not accept an optional default value. This breaks the established Python behavior of dictionary like items having a default if not present.
AFAICT services.config.Config inherits from dict and has the same behaviour as dict.get, so I guess you're talking about services.config.SvcConfigParser.

In that case, maybe it's better to be consistent with ConfigParser.ConfigParser.get(), which takes a dict of defaults rather than a single value?
(In reply to Ryan Kelly [:rfkelly] from comment #1)
> AFAICT services.config.Config inherits from dict and has the same behaviour
> as dict.get, so I guess you're talking about services.config.SvcConfigParser.

This is a recent change... the Config object itself used to inherit from RawConfigParser and thus didn't support a default value.

> In that case, maybe it's better to be consistent with
> ConfigParser.ConfigParser.get(), which takes a dict of defaults rather than
> a single value?

The config parser should really be an implementation detail going forward, so my guess is that this bug is soon to be obsolete.
We cleaned up all the dictionary handling for cornice, so if there are still nastinesses in there, let's file a new bug for that.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.