# HG changeset patch # User Mads Kiilerich # Date 1566136353 -7200 # Node ID 41f780117963671ccf2dbc77f0ee1aa19370ef86 # Parent e6b9194ab3f8152326258c8fc0214ae78e7e8d66 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 ... diff -r e6b9194ab3f8 -r 41f780117963 kallithea/lib/helpers.py --- 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)