add import and name => opt._name

This commit is contained in:
Emmanuel Garette 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 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
class Values(object):
@ -161,12 +162,12 @@ class Values(object):
# this result **shall not** be a list
if isinstance(result, list):
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
if value != None and not opt.validate(value,
self.context._cfgimpl_settings.validator):
raise ConfigError('invalid calculated value returned'
' for option {0}'.format(name))
' for option {0}'.format(opt._name))
# frozen and force default
if not opt.has_callback() and opt.is_forced_on_freeze():
value = opt.getdefault()