mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-15 07:04:53 +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)
|
||||
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
|
||||
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user