no more restore_validation
This commit is contained in:
@ -137,8 +137,6 @@ class OptionBag:
|
||||
path,
|
||||
index,
|
||||
config_bag):
|
||||
if self.option != None:
|
||||
raise Exception('hu?')
|
||||
if path is None:
|
||||
path = config_bag.context.cfgimpl_get_description().impl_get_path_by_opt(option)
|
||||
self.path = path
|
||||
@ -157,18 +155,22 @@ class OptionBag:
|
||||
return True
|
||||
raise KeyError('unknown key {} for OptionBag'.format(key))
|
||||
|
||||
def copy(self):
|
||||
kwargs = {}
|
||||
option_bag = OptionBag()
|
||||
for key in self.__slots__:
|
||||
setattr(option_bag, key, getattr(self, key))
|
||||
return option_bag
|
||||
|
||||
|
||||
class ConfigBag:
|
||||
__slots__ = ('context', # link to the current context
|
||||
'properties', # properties for current context
|
||||
'permissives', # permissives for current context
|
||||
#'force_permissive', # force permissive
|
||||
'_validate', # validate
|
||||
)
|
||||
def __init__(self, context, **kwargs):
|
||||
#self.force_permissive = False
|
||||
self.context = context
|
||||
self._validate = True
|
||||
for key, value in kwargs.items():
|
||||
setattr(self, key, value)
|
||||
|
||||
@ -182,13 +184,7 @@ class ConfigBag:
|
||||
raise KeyError('unknown key {} for ConfigBag'.format(key))
|
||||
|
||||
def remove_validation(self):
|
||||
self._validate = 'validator' in self.properties
|
||||
if self._validate:
|
||||
self.properties = frozenset(self.properties - {'validator'})
|
||||
|
||||
def restore_validation(self):
|
||||
if self._validate:
|
||||
self.properties = frozenset(self.properties | {'validator'})
|
||||
self.properties = frozenset(self.properties - {'validator'})
|
||||
|
||||
def set_permissive(self):
|
||||
self.properties = frozenset(self.properties | {'permissive'})
|
||||
|
Reference in New Issue
Block a user