Mercurial > kallithea
changeset 7835:41f780117963
helpers: fix bad handling of select values with length 2 - 'hg' showed up as 'g' in repo types list
Strings with length 2 are not tuples ...
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 18 Aug 2019 15:52:33 +0200 |
parents | e6b9194ab3f8 |
children | 3fd3ce1dc646 |
files | kallithea/lib/helpers.py |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/helpers.py Sun Aug 18 19:50:49 2019 +0200 +++ b/kallithea/lib/helpers.py Sun Aug 18 15:52:33 2019 +0200 @@ -164,14 +164,13 @@ if isinstance(options, list): l = [] for x in options: - try: + if isinstance(x, tuple) and len(x) == 2: value, label = x - except ValueError: # too many values to unpack - if isinstance(x, basestring): - value = label = x - else: - log.error('invalid select option %r', x) - raise + elif isinstance(x, basestring): + value = label = x + else: + log.error('invalid select option %r', x) + raise l.append(Option(label, value)) options = Options(l) return webhelpers2_select(name, selected_values, options, id=id, **attrs)