Merge branch 'master' into orm
This commit is contained in:
commit
068f68460d
|
@ -120,7 +120,7 @@ def test_permissive_option():
|
||||||
config.u1
|
config.u1
|
||||||
except PropertiesOptionError as err:
|
except PropertiesOptionError as err:
|
||||||
props = err.proptype
|
props = err.proptype
|
||||||
assert props == ['disabled']
|
assert props == []
|
||||||
props = []
|
props = []
|
||||||
try:
|
try:
|
||||||
config.u2
|
config.u2
|
||||||
|
@ -143,7 +143,7 @@ def test_permissive_option():
|
||||||
config.u1
|
config.u1
|
||||||
except PropertiesOptionError as err:
|
except PropertiesOptionError as err:
|
||||||
props = err.proptype
|
props = err.proptype
|
||||||
assert props == ['disabled']
|
assert props == []
|
||||||
props = []
|
props = []
|
||||||
try:
|
try:
|
||||||
config.u2
|
config.u2
|
||||||
|
@ -182,20 +182,12 @@ def test_permissive_option_frozen():
|
||||||
setting = config.cfgimpl_get_settings()
|
setting = config.cfgimpl_get_settings()
|
||||||
config.read_write()
|
config.read_write()
|
||||||
setting.setpermissive(('frozen', 'disabled'), u1)
|
setting.setpermissive(('frozen', 'disabled'), u1)
|
||||||
try:
|
|
||||||
config.u1 = 1
|
|
||||||
except PropertiesOptionError as err:
|
|
||||||
props = err.proptype
|
|
||||||
assert set(props) == set(['frozen', 'disabled'])
|
|
||||||
setting.append('permissive')
|
|
||||||
config.u1 = 1
|
config.u1 = 1
|
||||||
assert config.u1 == 1
|
assert config.u1 == 1
|
||||||
|
setting.append('permissive')
|
||||||
|
assert config.u1 == 1
|
||||||
setting.remove('permissive')
|
setting.remove('permissive')
|
||||||
try:
|
assert config.u1 == 1
|
||||||
config.u1 = 1
|
|
||||||
except PropertiesOptionError as err:
|
|
||||||
props = err.proptype
|
|
||||||
assert set(props) == set(['frozen', 'disabled'])
|
|
||||||
|
|
||||||
|
|
||||||
def test_invalid_option_permissive():
|
def test_invalid_option_permissive():
|
||||||
|
|
|
@ -248,6 +248,8 @@ class Undefined():
|
||||||
|
|
||||||
|
|
||||||
undefined = Undefined()
|
undefined = Undefined()
|
||||||
|
|
||||||
|
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
class Property(object):
|
class Property(object):
|
||||||
"a property is responsible of the option's value access rules"
|
"a property is responsible of the option's value access rules"
|
||||||
|
@ -283,6 +285,7 @@ class Property(object):
|
||||||
self._properties.remove(propname)
|
self._properties.remove(propname)
|
||||||
self._setting._setproperties(self._properties, self._opt,
|
self._setting._setproperties(self._properties, self._opt,
|
||||||
self._path)
|
self._path)
|
||||||
|
|
||||||
def extend(self, propnames):
|
def extend(self, propnames):
|
||||||
"""Extends properties to the existing properties
|
"""Extends properties to the existing properties
|
||||||
|
|
||||||
|
@ -439,7 +442,8 @@ class Settings(object):
|
||||||
properties = copy(self._getproperties(opt_or_descr, path))
|
properties = copy(self._getproperties(opt_or_descr, path))
|
||||||
self_properties = copy(self._getproperties())
|
self_properties = copy(self._getproperties())
|
||||||
# remove opt permissive
|
# remove opt permissive
|
||||||
if force_permissive is True or 'permissive' in self_properties:
|
# permissive affect option's permission with or without permissive
|
||||||
|
# global property
|
||||||
properties -= self._p_.getpermissive(path)
|
properties -= self._p_.getpermissive(path)
|
||||||
# remove global permissive if need
|
# remove global permissive if need
|
||||||
if force_permissive is True or 'permissive' in self_properties:
|
if force_permissive is True or 'permissive' in self_properties:
|
||||||
|
|
Loading…
Reference in New Issue