Mercurial > libervia-backend
changeset 3233:8770397f8f82
tools (xl_tools): fixed handling of list options labels
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Mar 2020 09:50:42 +0100 (2020-03-27) |
parents | f3c99e96ac03 |
children | 78fea49735c5 |
files | sat/tools/xml_tools.py |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/tools/xml_tools.py Mon Mar 23 17:53:29 2020 +0100 +++ b/sat/tools/xml_tools.py Fri Mar 27 09:50:42 2020 +0100 @@ -471,7 +471,16 @@ elems = param.getElementsByTagName("option") if len(elems) == 0: return [] - options = [elem.getAttribute("value") for elem in elems] + options = [] + for elem in elems: + value = elem.getAttribute("value") + if not value: + raise exceptions.InternalError("list option must have a value") + label = elem.getAttribute("label") + if label: + options.append((value, label)) + else: + options.append(value) selected = [ elem.getAttribute("value") for elem in elems