translation

This commit is contained in:
2013-07-17 23:02:50 +02:00
parent 15ac8c2872
commit bc054d75af
2 changed files with 20 additions and 11 deletions

View File

@ -248,7 +248,7 @@ class SubConfig(BaseInformation):
_subpath=self.cfgimpl_get_path())
def find_first(self, bytype=None, byname=None, byvalue=None,
type_='option'):
type_='option', display_error=True):
"""
finds an option recursively in the config
@ -260,10 +260,11 @@ class SubConfig(BaseInformation):
return self.cfgimpl_get_context()._find(bytype, byname, byvalue,
first=True,
type_=type_,
_subpath=self.cfgimpl_get_path())
_subpath=self.cfgimpl_get_path(),
display_error=display_error)
def _find(self, bytype, byname, byvalue, first, type_='option',
_subpath=None, check_properties=True):
_subpath=None, check_properties=True, display_error=True):
"""
convenience method for finding an option that lives only in the subtree
@ -346,9 +347,10 @@ class SubConfig(BaseInformation):
else:
find_results.append(retval)
if find_results == []:
#FIXME too slow
#raise AttributeError(_("no option found in config with these criteria"))
raise AttributeError("no option found in config with these criteria")
if display_error:
raise AttributeError(_("no option found in config with these criteria"))
else:
raise AttributeError()
else:
return find_results
@ -568,7 +570,8 @@ class MetaConfig(CommonConfig):
except PropertiesOptionError:
pass
def find_first_contexts(self, byname=None, bypath=None, byvalue=None, type_='context'):
def find_first_contexts(self, byname=None, bypath=None, byvalue=None,
type_='context', display_error=True):
ret = []
try:
if bypath is None and byname is not None and \
@ -592,12 +595,14 @@ class MetaConfig(CommonConfig):
else:
ret.append(child.find_first(byname=byname,
byvalue=byvalue,
type_=type_))
type_=type_,
display_error=False))
else:
ret.extend(child.find_first_contexts(byname=byname,
bypath=bypath,
byvalue=byvalue,
type_=type_))
type_=type_,
display_error=False))
except AttributeError:
pass
return ret