Add "force_store_value" property. If set, store, for example, calculated value as owner values.

So calculated value are calculate only one time.
This commit is contained in:
Emmanuel Garette 2013-04-16 09:45:42 +02:00
parent 1f0bb88bc1
commit 447c175b6a
1 changed files with 5 additions and 2 deletions

View File

@ -146,6 +146,9 @@ class Values(object):
if validate and not opt.validate(value, self.context, setting.has_property('validator')):
raise ValueError(_('invalid calculated value returned'
' for option {0}: {1}').format(opt._name, value))
if self.is_default_owner(opt) and \
setting.has_property('auto_store_value', opt, False):
self.setitem(opt, value)
return value
def __setitem__(self, opt, value):