do same api for property and permissive
This commit is contained in:
@ -659,25 +659,32 @@ class Settings(object):
|
||||
|
||||
def reset(self,
|
||||
option_bag,
|
||||
context,
|
||||
all_properties=False):
|
||||
context):
|
||||
if option_bag is None:
|
||||
opt = None
|
||||
path = None
|
||||
else:
|
||||
opt = option_bag.option
|
||||
assert all_properties is False or option_bag is None, _('opt and all_properties must not be'
|
||||
' set together in reset')
|
||||
if opt and opt.impl_is_symlinkoption():
|
||||
raise TypeError(_("can't reset properties to the symlinkoption \"{}\""
|
||||
"").format(opt.impl_get_display_name()))
|
||||
if all_properties:
|
||||
self._p_.reset_all_properties()
|
||||
assert not opt.impl_is_symlinkoption(), _("can't reset properties to "
|
||||
"the symlinkoption \"{}\""
|
||||
"").format(opt.impl_get_display_name())
|
||||
path = option_bag.path
|
||||
self._p_.delproperties(path)
|
||||
context.cfgimpl_reset_cache(option_bag)
|
||||
|
||||
def reset_permissives(self,
|
||||
option_bag,
|
||||
context):
|
||||
if option_bag is None:
|
||||
opt = None
|
||||
path = None
|
||||
else:
|
||||
if opt is not None:
|
||||
path = option_bag.path
|
||||
else:
|
||||
path = None
|
||||
self._p_.delproperties(path)
|
||||
opt = option_bag.option
|
||||
assert not opt.impl_is_symlinkoption(), _("can't reset permissives to "
|
||||
"the symlinkoption \"{}\""
|
||||
"").format(opt.impl_get_display_name())
|
||||
path = option_bag.path
|
||||
self._pp_.delpermissive(path)
|
||||
context.cfgimpl_reset_cache(option_bag)
|
||||
|
||||
#____________________________________________________________
|
||||
|
Reference in New Issue
Block a user