diff --git a/plugins/Config/plugin.py b/plugins/Config/plugin.py index f065474d2..ac0f81c5e 100644 --- a/plugins/Config/plugin.py +++ b/plugins/Config/plugin.py @@ -54,12 +54,12 @@ def getWrapper(name): raise registry.InvalidRegistryName(name) group = getattr(conf, parts.pop(0)) while parts: - try: - group = group.get(parts.pop(0)) - # We'll catch registry.InvalidRegistryName and re-raise it here so - # that we have a useful error message for the user. - except (registry.NonExistentRegistryEntry, - registry.InvalidRegistryName): + part = parts.pop(0) + if group.__hasattr__(part): + group = group.get(part) + else: + # We'll raise registry.InvalidRegistryName here so + # that we have a useful error message for the user. raise registry.InvalidRegistryName(name) return group diff --git a/src/registry.py b/src/registry.py index ef67c4264..820aaa06a 100644 --- a/src/registry.py +++ b/src/registry.py @@ -214,6 +214,9 @@ class Group(object): self.register(attr, v) return v + def __hasattr__(self, attr): + return attr in self._children + def __getattr__(self, attr): if attr in self._children: return self._children[attr]