Module: check_mk
Branch: master
Commit: 5181a456306a2669d35c107262aa9b19f2861bb1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5181a456306a26…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Oct 25 14:40:41 2018 +0200
Fix a name shadowing problem that lead to a crash when declaring user attributes
Change-Id: I7416522d4e8f7c4f1f65216b2b7c710c09945d28
---
cmk/gui/userdb.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/cmk/gui/userdb.py b/cmk/gui/userdb.py
index 60d16dd..8bb2ef7 100644
--- a/cmk/gui/userdb.py
+++ b/cmk/gui/userdb.py
@@ -519,11 +519,16 @@ def declare_user_attribute(name, vs, user_editable = True,
permission = None,
show_in_table = False, topic = None, add_custom_macro =
False,
domain = "multisite", from_config = False):
+ # FIXME: The classmethods "name" and "topic" shadow the arguments
from the function scope.
+ # Any use off "name" and "topic" inside the class will result in
a NameError.
+ attr_name = name
+ attr_topic = topic
+
@user_attribute_registry.register
class LegacyUserAttribute(GenericUserAttribute):
- _name = name
+ _name = attr_name
_valuespec = vs
- _topic = topic if topic else 'personal'
+ _topic = attr_topic if attr_topic else 'personal'
@classmethod
def name(cls):