diff options
author | Josh Blum <josh@joshknows.com> | 2017-07-30 14:32:02 +0200 |
---|---|---|
committer | Sebastian Koslowski <sebastian.koslowski@gmail.com> | 2017-07-30 14:34:22 +0200 |
commit | e6d0e8f3d6468a807574b3cf5f480e094048a3f7 (patch) | |
tree | 81143b0e457da799c18d0f5ff166fdd6fcd80f46 | |
parent | dd1ea1ff8dca65c512cfdb8ca0dbd4711da3f526 (diff) |
grc: fix attr-style enum param lookup in Cheeteh
-rw-r--r-- | grc/core/Param.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/grc/core/Param.py b/grc/core/Param.py index 26f9d2f451..9c26e02d90 100644 --- a/grc/core/Param.py +++ b/grc/core/Param.py @@ -135,6 +135,14 @@ class TemplateArg(object): def __getitem__(self, item): return str(self._param.get_opt(item)) if self._param.is_enum() else NotImplemented + def __getattr__(self, item): + 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()) |