owner test
This commit is contained in:
@ -494,6 +494,15 @@ class TiramisuContextOwner(TiramisuContext):
|
||||
def get(self):
|
||||
return self.config_bag.config.cfgimpl_get_settings().getowner()
|
||||
|
||||
@count
|
||||
def set(self, owner):
|
||||
try:
|
||||
obj_owner = getattr(owners, owner)
|
||||
except AttributeError:
|
||||
owners.addowner(owner)
|
||||
obj_owner = getattr(owners, owner)
|
||||
self.config_bag.config.cfgimpl_get_settings().setowner(obj_owner)
|
||||
|
||||
|
||||
class TiramisuContextProperty(TiramisuContext):
|
||||
@count
|
||||
@ -595,15 +604,15 @@ class TiramisuDispatcherOption(TiramisuContextOption):
|
||||
config_bag.option = opt
|
||||
if index is not None and not opt.impl_is_master_slaves('slave'):
|
||||
raise APIError('index must be set only with a slave option')
|
||||
if opt.impl_is_symlinkoption():
|
||||
config_bag.ori_option = config_bag.option
|
||||
config_bag.option = opt.impl_getopt()
|
||||
true_path = config_bag.option.impl_getpath(self.config_bag.config)
|
||||
config_bag.config.unwrap_from_path(true_path,
|
||||
index,
|
||||
config_bag)
|
||||
else:
|
||||
true_path = None
|
||||
#if opt.impl_is_symlinkoption():
|
||||
# config_bag.ori_option = config_bag.option
|
||||
# config_bag.option = opt.impl_getopt()
|
||||
# true_path = config_bag.option.impl_getpath(self.config_bag.config)
|
||||
# config_bag.config.unwrap_from_path(true_path,
|
||||
# index,
|
||||
# config_bag)
|
||||
#else:
|
||||
# true_path = None
|
||||
return TiramisuOption(path,
|
||||
index,
|
||||
config_bag)
|
||||
|
@ -450,6 +450,17 @@ class Values(object):
|
||||
#______________________________________________________________________
|
||||
# owner
|
||||
|
||||
def is_default_owner(self,
|
||||
path,
|
||||
index,
|
||||
config_bag,
|
||||
validate_meta=undefined):
|
||||
return self._getowner(path,
|
||||
index,
|
||||
config_bag,
|
||||
validate_meta=validate_meta,
|
||||
only_default=True) == owners.default
|
||||
|
||||
def getowner(self,
|
||||
path,
|
||||
index,
|
||||
@ -462,12 +473,6 @@ class Values(object):
|
||||
was present
|
||||
:returns: a `setting.owners.Owner` object
|
||||
"""
|
||||
opt = config_bag.option
|
||||
if opt.impl_is_symlinkoption():
|
||||
config_bag.ori_option = opt
|
||||
opt = opt.impl_getopt()
|
||||
config_bag.option = opt
|
||||
path = opt.impl_getpath(self._getcontext())
|
||||
return self._getowner(path,
|
||||
index,
|
||||
config_bag)
|
||||
@ -543,19 +548,6 @@ class Values(object):
|
||||
index,
|
||||
config_bag)
|
||||
self._p_.setowner(path, owner, index=index)
|
||||
|
||||
def is_default_owner(self,
|
||||
path,
|
||||
index,
|
||||
config_bag,
|
||||
validate_meta=undefined):
|
||||
owner = self._getowner(path,
|
||||
index,
|
||||
config_bag,
|
||||
validate_meta=validate_meta,
|
||||
only_default=True)
|
||||
return owner == owners.default
|
||||
|
||||
#______________________________________________________________________
|
||||
# reset
|
||||
|
||||
|
Reference in New Issue
Block a user