Parameter.child raises KeyError if requested child name does not exist
This commit is contained in:
parent
0f910c45d1
commit
bf31a5ba99
|
@ -653,15 +653,16 @@ class Parameter(QtCore.QObject):
|
||||||
"""Return a child parameter.
|
"""Return a child parameter.
|
||||||
Accepts the name of the child or a tuple (path, to, child)
|
Accepts the name of the child or a tuple (path, to, child)
|
||||||
|
|
||||||
Added in version 0.9.9. Ealier versions used the 'param' method, which is still
|
Added in version 0.9.9. Earlier versions used the 'param' method, which is still
|
||||||
implemented for backward compatibility."""
|
implemented for backward compatibility.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
param = self.names[names[0]]
|
param = self.names[names[0]]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise Exception("Parameter %s has no child named %s" % (self.name(), names[0]))
|
raise KeyError("Parameter %s has no child named %s" % (self.name(), names[0]))
|
||||||
|
|
||||||
if len(names) > 1:
|
if len(names) > 1:
|
||||||
return param.param(*names[1:])
|
return param.child(*names[1:])
|
||||||
else:
|
else:
|
||||||
return param
|
return param
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user