add check_frozen in master/slaves

This commit is contained in:
Emmanuel Garette 2017-05-05 21:40:44 +02:00
parent 6ca3e236f9
commit 1ee7d500dd
2 changed files with 12 additions and 8 deletions

View File

@ -117,30 +117,32 @@ class MasterSlaves(object):
def getitem(self, values, opt, path, validate, force_permissive, def getitem(self, values, opt, path, validate, force_permissive,
trusted_cached_properties, validate_properties, session, trusted_cached_properties, validate_properties, session,
slave_path=undefined, slave_value=undefined, slave_path=undefined, slave_value=undefined,
setting_properties=undefined, self_properties=undefined, index=None): setting_properties=undefined, self_properties=undefined, index=None,
check_frozen=False):
if self.is_master(opt): if self.is_master(opt):
return self._getmaster(values, opt, path, validate, return self._getmaster(values, opt, path, validate,
force_permissive, force_permissive,
validate_properties, slave_path, validate_properties, slave_path,
slave_value, self_properties, index, slave_value, self_properties, index,
setting_properties, session) setting_properties, session, check_frozen)
else: else:
return self._getslave(values, opt, path, validate, return self._getslave(values, opt, path, validate,
force_permissive, trusted_cached_properties, force_permissive, trusted_cached_properties,
validate_properties, setting_properties, validate_properties, setting_properties,
self_properties, index, self_properties, index,
session) session, check_frozen)
def _getmaster(self, values, opt, path, validate, force_permissive, def _getmaster(self, values, opt, path, validate, force_permissive,
validate_properties, c_slave_path, validate_properties, c_slave_path,
c_slave_value, self_properties, index, c_slave_value, self_properties, index,
setting_properties, session): setting_properties, session, check_frozen):
value = values._get_cached_value(opt, path=path, validate=validate, value = values._get_cached_value(opt, path=path, validate=validate,
force_permissive=force_permissive, force_permissive=force_permissive,
validate_properties=validate_properties, validate_properties=validate_properties,
self_properties=self_properties, self_properties=self_properties,
from_masterslave=True, index=index, from_masterslave=True, index=index,
setting_properties=setting_properties) setting_properties=setting_properties,
check_frozen=check_frozen)
if isinstance(value, Exception): if isinstance(value, Exception):
return value return value
if index is None and validate is True: if index is None and validate is True:
@ -153,7 +155,7 @@ class MasterSlaves(object):
def _getslave(self, values, opt, path, validate, force_permissive, def _getslave(self, values, opt, path, validate, force_permissive,
trusted_cached_properties, validate_properties, setting_properties, trusted_cached_properties, validate_properties, setting_properties,
self_properties, index, session): self_properties, index, session, check_frozen):
""" """
if master has length 0: if master has length 0:
return [] return []
@ -215,7 +217,8 @@ class MasterSlaves(object):
#self_properties=self_properties, #self_properties=self_properties,
setting_properties=setting_properties, setting_properties=setting_properties,
masterlen=masterlen, masterlen=masterlen,
from_masterslave=True) from_masterslave=True,
check_frozen=check_frozen)
if isinstance(value, Exception): if isinstance(value, Exception):
if isinstance(value, PropertiesOptionError): if isinstance(value, PropertiesOptionError):
err = value err = value

View File

@ -282,7 +282,8 @@ class Values(object):
session, session,
setting_properties=setting_properties, setting_properties=setting_properties,
index=index, index=index,
self_properties=self_properties) self_properties=self_properties,
check_frozen=check_frozen)
else: else:
val = self._get_validated_value(opt, path, validate, val = self._get_validated_value(opt, path, validate,
force_permissive, force_permissive,