Show More
@@ -162,8 +162,10 b' def reset(name, value, id=NotGiven, **at' | |||||
162 | def select(name, selected_values, options, id=NotGiven, **attrs): |
|
162 | def select(name, selected_values, options, id=NotGiven, **attrs): | |
163 | """Convenient wrapper of webhelpers2 to let it accept options as a tuple list""" |
|
163 | """Convenient wrapper of webhelpers2 to let it accept options as a tuple list""" | |
164 | if isinstance(options, list): |
|
164 | if isinstance(options, list): | |
165 | l = [] |
|
165 | option_list = options | |
166 | for x in options: |
|
166 | # Handle old style value,label lists | |
|
167 | options = Options() | |||
|
168 | for x in option_list: | |||
167 | if isinstance(x, tuple) and len(x) == 2: |
|
169 | if isinstance(x, tuple) and len(x) == 2: | |
168 | value, label = x |
|
170 | value, label = x | |
169 | elif isinstance(x, basestring): |
|
171 | elif isinstance(x, basestring): | |
@@ -171,8 +173,7 b' def select(name, selected_values, option' | |||||
171 | else: |
|
173 | else: | |
172 | log.error('invalid select option %r', x) |
|
174 | log.error('invalid select option %r', x) | |
173 | raise |
|
175 | raise | |
174 |
|
|
176 | options.add_option(label, value) | |
175 | options = Options(l) |
|
|||
176 | return webhelpers2_select(name, selected_values, options, id=id, **attrs) |
|
177 | return webhelpers2_select(name, selected_values, options, id=id, **attrs) | |
177 |
|
178 | |||
178 |
|
179 |
General Comments 0
You need to be logged in to leave comments.
Login now