diff --git a/autolib.py b/autolib.py index 20e12fb..e339829 100644 --- a/autolib.py +++ b/autolib.py @@ -19,6 +19,7 @@ # the whole pypy projet is under MIT licence # ____________________________________________________________ "enables us to carry out a calculation and return an option's value" +from tiramisu.error import DisabledOptionError, SpecialOwnersError # ____________________________________________________________ # automatic Option object special_owners = ['auto', 'fill'] @@ -31,7 +32,7 @@ def special_owner_factory(name, owner, value, # we have to carry out a calculation return calc_factory(name, callback, callback_params, config) -g = globals() +#g = globals() def calc_factory(name, callback, callback_params, config): # FIXME we have to know the exact status of the config @@ -39,6 +40,7 @@ def calc_factory(name, callback, callback_params, config): # config.freeze() if callback_params is None: callback_params = {} + tcparams = {} for key, value in callback_params.items(): if type(value) == tuple: path, check_disabled = value @@ -46,20 +48,18 @@ def calc_factory(name, callback, callback_params, config): opt_value = getattr(config, path) except DisabledOptionError, e: if chek_disabled: - del(callback_params[key]) continue raise DisabledOptionError(e) - callback_params[key] = opt_value + tcparams[key] = opt_value + else: + tcparams[key] = value try: #return getattr(autolib, callback)(name, config) - return g[callback](name, config, **callback_params) + #return g[callback](name, config, **callback_params) + from creole import eosfunc + return getattr(eosfunc, callback)(**tcparams) except AttributeError: + import traceback + traceback.print_exc() raise SpecialOwnersError("callback: {0} not found for " "option: {1}".format(callback, name)) -# ____________________________________________________________ - -# FIXME: import eosfunc here -def identical(name, config, *args): - return "identical" + name - - diff --git a/config.py b/config.py index 1c34288..f9610ff 100644 --- a/config.py +++ b/config.py @@ -67,7 +67,13 @@ class Config(object): for child in self._cfgimpl_descr._children: if isinstance(child, Option): self._cfgimpl_values[child._name] = child.getdefault() - self._cfgimpl_value_owners[child._name] = 'default' + if child.getcallback() is not None: + if child._is_hidden(): + self._cfgimpl_value_owners[child._name] = 'auto' + else: + self._cfgimpl_value_owners[child._name] = 'fill' + else: + self._cfgimpl_value_owners[child._name] = 'default' elif isinstance(child, OptionDescription): self._validate_duplicates(child._children) self._cfgimpl_values[child._name] = Config(child, parent=self) @@ -195,7 +201,7 @@ class Config(object): value=self._cfgimpl_values[name], callback=opt_or_descr.getcallback(), callback_params=opt_or_descr.getcallback_params(), - config=self) + config=self._cfgimpl_get_toplevel()) # mandatory options if not isinstance(opt_or_descr, OptionDescription): homeconfig = self._cfgimpl_get_toplevel()