mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Config: Prevent variable creation when trying to get the value of a channel-specific variable for a non-channel.
This commit is contained in:
parent
fd2ecf0dec
commit
b14ed2c5d9
@ -54,12 +54,12 @@ def getWrapper(name):
|
|||||||
raise registry.InvalidRegistryName(name)
|
raise registry.InvalidRegistryName(name)
|
||||||
group = getattr(conf, parts.pop(0))
|
group = getattr(conf, parts.pop(0))
|
||||||
while parts:
|
while parts:
|
||||||
try:
|
part = parts.pop(0)
|
||||||
group = group.get(parts.pop(0))
|
if group.__hasattr__(part):
|
||||||
# We'll catch registry.InvalidRegistryName and re-raise it here so
|
group = group.get(part)
|
||||||
# that we have a useful error message for the user.
|
else:
|
||||||
except (registry.NonExistentRegistryEntry,
|
# We'll raise registry.InvalidRegistryName here so
|
||||||
registry.InvalidRegistryName):
|
# that we have a useful error message for the user.
|
||||||
raise registry.InvalidRegistryName(name)
|
raise registry.InvalidRegistryName(name)
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
@ -214,6 +214,9 @@ class Group(object):
|
|||||||
self.register(attr, v)
|
self.register(attr, v)
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
def __hasattr__(self, attr):
|
||||||
|
return attr in self._children
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
if attr in self._children:
|
if attr in self._children:
|
||||||
return self._children[attr]
|
return self._children[attr]
|
||||||
|
Loading…
Reference in New Issue
Block a user