summaryrefslogtreecommitdiff
path: root/grc/core/Param.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/core/Param.py')
-rw-r--r--grc/core/Param.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/grc/core/Param.py b/grc/core/Param.py
index e8c81383f3..a1e4c782fb 100644
--- a/grc/core/Param.py
+++ b/grc/core/Param.py
@@ -54,10 +54,19 @@ class TemplateArg(str):
setattr(instance, '_param', param)
return instance
+ def __getitem__(self, item):
+ return str(self._param.get_opt(item)) if self._param.is_enum() else NotImplemented
+
def __getattr__(self, item):
- param = self._param
- attributes = param.options.attributes[param.get_value()]
- return str(attributes.get(item)) or NotImplemented
+ if not self._param.is_enum():
+ raise AttributeError()
+ try:
+ return str(self._param.get_opt(item))
+ except KeyError:
+ raise AttributeError()
+
+ def __str__(self):
+ return str(self._param.to_code())
def __call__(self):
return self._param.get_evaluated()