add import and name => opt._name

This commit is contained in:
Garette Emmanuel 2013-03-25 11:45:21 +01:00
parent f6a14e3223
commit 39c8e2eb0b

View file

@ -20,7 +20,8 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/ # the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence # the whole pypy projet is under MIT licence
# ____________________________________________________________ # ____________________________________________________________
from tiramisu.error import NoValueReturned, MandatoryError, MultiTypeError from tiramisu.error import NoValueReturned, MandatoryError, MultiTypeError, \
ConfigError
from tiramisu.setting import owners, multitypes from tiramisu.setting import owners, multitypes
class Values(object): class Values(object):
@ -161,12 +162,12 @@ class Values(object):
# this result **shall not** be a list # this result **shall not** be a list
if isinstance(result, list): if isinstance(result, list):
raise ConfigError('invalid calculated value returned ' raise ConfigError('invalid calculated value returned '
'for option {0} : shall not be a list'.format(name)) 'for option {0} : shall not be a list'.format(opt._name))
value = result value = result
if value != None and not opt.validate(value, if value != None and not opt.validate(value,
self.context._cfgimpl_settings.validator): self.context._cfgimpl_settings.validator):
raise ConfigError('invalid calculated value returned' raise ConfigError('invalid calculated value returned'
' for option {0}'.format(name)) ' for option {0}'.format(opt._name))
# frozen and force default # frozen and force default
if not opt.has_callback() and opt.is_forced_on_freeze(): if not opt.has_callback() and opt.is_forced_on_freeze():
value = opt.getdefault() value = opt.getdefault()