suppression of the notion of normal and expert mode
This commit is contained in:
parent
d05feb78f9
commit
5ee7247e52
2 changed files with 3 additions and 20 deletions
|
@ -8,7 +8,6 @@ from tiramisu.option import *
|
|||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ['ref', 'framework'], 'ref')
|
||||
gcoption.set_mode("expert")
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
# hidding dummy here
|
||||
gcdummy.hide()
|
||||
|
@ -31,7 +30,6 @@ def make_description():
|
|||
# ____________________________________________________________
|
||||
|
||||
gcgroup = OptionDescription('gc', '', [subgroup, gcoption, gcdummy, floatoption])
|
||||
gcgroup.set_mode("expert")
|
||||
descr = OptionDescription('trs', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
|
@ -133,9 +131,3 @@ def test_with_many_subgroups():
|
|||
option = getattr(homeconfig._cfgimpl_descr, name)
|
||||
assert option._is_hidden()
|
||||
|
||||
def test_option_mode():
|
||||
descr = make_description()
|
||||
config = Config(descr)
|
||||
assert config.gc._cfgimpl_descr.name.get_mode() == 'expert'
|
||||
assert config._cfgimpl_descr.gc.get_mode() == 'expert'
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class Option(HiddenBaseType, DisabledBaseType):
|
|||
_frozen = False
|
||||
def __init__(self, name, doc, default=None, default_multi=None,
|
||||
requires=None, mandatory=False, multi=False, callback=None,
|
||||
callback_params=None, mode='normal'):
|
||||
callback_params=None):
|
||||
self._name = name
|
||||
self.doc = doc
|
||||
self._requires = requires
|
||||
|
@ -108,9 +108,6 @@ class Option(HiddenBaseType, DisabledBaseType):
|
|||
raise ConfigError("params defined for a callback function but"
|
||||
" no callback defined yet for option {0}".format(name))
|
||||
self.callback_params = callback_params
|
||||
if mode not in modes:
|
||||
raise ConfigError("mode {0} not available".format(mode))
|
||||
self.mode = mode
|
||||
if self.multi == True:
|
||||
if default == None:
|
||||
default = []
|
||||
|
@ -262,16 +259,10 @@ class ChoiceOption(Option):
|
|||
class BoolOption(Option):
|
||||
opt_type = 'bool'
|
||||
|
||||
# def __init__(self, name, doc, default=None, requires=None,
|
||||
# validator=None, multi=False, mandatory=False):
|
||||
# super(BoolOption, self).__init__(name, doc, default=default,
|
||||
# requires=requires, multi=multi, mandatory=mandatory)
|
||||
#self._validator = validator
|
||||
|
||||
def _validate(self, value):
|
||||
return isinstance(value, bool)
|
||||
|
||||
# FIXME config level validator
|
||||
# config level validator
|
||||
# def setoption(self, config, value, who):
|
||||
# name = self._name
|
||||
# if value and self._validator is not None:
|
||||
|
@ -323,7 +314,7 @@ class StrOption(Option):
|
|||
except TypeError, e:
|
||||
raise ConfigError(*e.args)
|
||||
|
||||
class SymLinkOption(object): #(HiddenBaseType, DisabledBaseType):
|
||||
class SymLinkOption(object):
|
||||
opt_type = 'symlink'
|
||||
|
||||
def __init__(self, name, path):
|
||||
|
|
Loading…
Reference in a new issue