default settings
This commit is contained in:
parent
c53d574ac2
commit
a95f19d5f4
|
@ -32,7 +32,7 @@ ro_remove = ('permissive', 'hidden')
|
||||||
ro_append = ('frozen', 'disabled', 'validator', 'everything_frozen', 'mandatory')
|
ro_append = ('frozen', 'disabled', 'validator', 'everything_frozen', 'mandatory')
|
||||||
rw_remove = ('permissive', 'everything_frozen', 'mandatory')
|
rw_remove = ('permissive', 'everything_frozen', 'mandatory')
|
||||||
rw_append = ('frozen', 'disabled', 'validator', 'hidden')
|
rw_append = ('frozen', 'disabled', 'validator', 'hidden')
|
||||||
|
default_properties = set(('expire', 'validator'))
|
||||||
|
|
||||||
class _const:
|
class _const:
|
||||||
"""convenient class that emulates a module
|
"""convenient class that emulates a module
|
||||||
|
@ -182,7 +182,7 @@ class Setting(object):
|
||||||
def __init__(self, context):
|
def __init__(self, context):
|
||||||
# properties attribute: the name of a property enables this property
|
# properties attribute: the name of a property enables this property
|
||||||
# key is None for global properties
|
# key is None for global properties
|
||||||
self._properties = {None: set(('expire', 'validator'))}
|
self._properties = {}
|
||||||
# permissive properties
|
# permissive properties
|
||||||
self._permissives = {}
|
self._permissives = {}
|
||||||
# generic owner
|
# generic owner
|
||||||
|
@ -204,9 +204,16 @@ class Setting(object):
|
||||||
def __setitem__(self, opt, value):
|
def __setitem__(self, opt, value):
|
||||||
raise ValueError('you must only append/remove properties')
|
raise ValueError('you must only append/remove properties')
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
try:
|
||||||
|
del(self._properties[None])
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
self.context.cfgimpl_reset_cache()
|
||||||
|
|
||||||
def _get_properties(self, opt=None, is_apply_req=True):
|
def _get_properties(self, opt=None, is_apply_req=True):
|
||||||
if opt is None:
|
if opt is None:
|
||||||
props = self._properties.get(opt, set())
|
props = self._properties.get(opt, copy(default_properties))
|
||||||
else:
|
else:
|
||||||
exp = None
|
exp = None
|
||||||
if opt in self._cache:
|
if opt in self._cache:
|
||||||
|
|
Loading…
Reference in New Issue