diff options
author | Mark McLoughlin <markmc@redhat.com> | 2011-11-28 14:38:34 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2011-12-07 15:25:47 +0000 |
commit | 0c78c2ed61c84ff967c2e6894f5dcff0987c2dec (patch) | |
tree | 27e736a5700799e577f8919515857e6a4d349543 /nova/flags.py | |
parent | 45e31ab90d22cbb84a33c051ee43f273b7a4c38b (diff) | |
download | nova-0c78c2ed61c84ff967c2e6894f5dcff0987c2dec.tar.gz nova-0c78c2ed61c84ff967c2e6894f5dcff0987c2dec.tar.xz nova-0c78c2ed61c84ff967c2e6894f5dcff0987c2dec.zip |
Remove extra_context support in Flags
This doesn't seem to be used at all any more.
Change-Id: I3a4a1eb271f547ad1723676dc47f1d8c8bad88ea
Diffstat (limited to 'nova/flags.py')
-rw-r--r-- | nova/flags.py | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/nova/flags.py b/nova/flags.py index e0f1ceded..dc4e648f0 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -68,10 +68,9 @@ class FlagValues(object): a = self._error_msg[self._error_msg.rindex(": --") + 2:] return filter(lambda i: i == a or i.startswith(a + "="), args)[0] - def __init__(self, extra_context=None): + def __init__(self): self._parser = optparse.OptionParser() self._parser.disable_interspersed_args() - self._extra_context = extra_context self._multistring_defaults = {} self.Reset() @@ -138,8 +137,7 @@ class FlagValues(object): val = getattr(self._values, name) if type(val) is str: tmpl = string.Template(val) - context = [self, self._extra_context] - return tmpl.substitute(StrWrapper(context)) + return tmpl.substitute(vars(self._values)) return val def get(self, name, default): @@ -220,24 +218,6 @@ class FlagValues(object): FLAGS = FlagValues() -class StrWrapper(object): - """Wrapper around FlagValues objects. - - Wraps FlagValues objects for string.Template so that we're - sure to return strings. - - """ - def __init__(self, context_objs): - self.context_objs = context_objs - - def __getitem__(self, name): - for context in self.context_objs: - val = getattr(context, name, False) - if val: - return str(val) - raise KeyError(name) - - def DEFINE_string(name, default, help, flag_values=FLAGS): flag_values.define_string(name, default, help) |