Merge branch 'master' into orm

This commit is contained in:
Emmanuel Garette 2014-01-18 10:25:09 +01:00
commit 068f68460d
2 changed files with 11 additions and 15 deletions

View File

@ -120,7 +120,7 @@ def test_permissive_option():
config.u1
except PropertiesOptionError as err:
props = err.proptype
assert props == ['disabled']
assert props == []
props = []
try:
config.u2
@ -143,7 +143,7 @@ def test_permissive_option():
config.u1
except PropertiesOptionError as err:
props = err.proptype
assert props == ['disabled']
assert props == []
props = []
try:
config.u2
@ -182,20 +182,12 @@ def test_permissive_option_frozen():
setting = config.cfgimpl_get_settings()
config.read_write()
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
assert config.u1 == 1
setting.append('permissive')
assert config.u1 == 1
setting.remove('permissive')
try:
config.u1 = 1
except PropertiesOptionError as err:
props = err.proptype
assert set(props) == set(['frozen', 'disabled'])
assert config.u1 == 1
def test_invalid_option_permissive():

View File

@ -248,6 +248,8 @@ class Undefined():
undefined = Undefined()
# ____________________________________________________________
class Property(object):
"a property is responsible of the option's value access rules"
@ -283,6 +285,7 @@ class Property(object):
self._properties.remove(propname)
self._setting._setproperties(self._properties, self._opt,
self._path)
def extend(self, propnames):
"""Extends properties to the existing properties
@ -439,7 +442,8 @@ class Settings(object):
properties = copy(self._getproperties(opt_or_descr, path))
self_properties = copy(self._getproperties())
# 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)
# remove global permissive if need
if force_permissive is True or 'permissive' in self_properties: