getowner need now an option

This commit is contained in:
2013-08-24 22:32:54 +02:00
parent 4c27cb586d
commit e4c129efc5
10 changed files with 106 additions and 98 deletions

View File

@ -484,11 +484,13 @@ class CommonConfig(SubConfig):
"read write is a global config's setting, see `settings.py`"
self.cfgimpl_get_settings().read_write()
def getowner(self, path):
def getowner(self, opt):
"""convenience method to retrieve an option's owner
from the config itself
"""
opt = self.cfgimpl_get_description().impl_get_opt_by_path(path)
if not isinstance(opt, Option) and not isinstance(opt, SymLinkOption):
raise TypeError(_('opt in getowner must be an option not {0}'
'').format(type(opt)))
return self.cfgimpl_get_values().getowner(opt)
def unwrap_from_path(self, path, force_permissive=False):
@ -552,9 +554,9 @@ class MetaConfig(CommonConfig):
if meta:
for child in children:
if not isinstance(child, CommonConfig):
raise ValueError(_("metaconfig's children "
"must be config, not {0}"
).format(type(child)))
raise TypeError(_("metaconfig's children "
"must be config, not {0}"
).format(type(child)))
if self._impl_descr is None:
self._impl_descr = child.cfgimpl_get_description()
elif not self._impl_descr is child.cfgimpl_get_description():