Do not fail when completing selection with last value None
This may happen when searching for several values which need to be quoted using ';"'. issue6714 review41511002
This commit is contained in:
1 parent
b5872e7350
commit
2a0607f1eb
1 file changed
+2
-1
@@ -687,7 +687,7 @@ def complete_value(field, value):
|
||||
def complete_selection():
|
||||
test_value = value if value is not None else ''
|
||||
if isinstance(value, list):
|
||||
test_value = value[-1]
|
||||
test_value = value[-1] or ''
|
||||
test_value = test_value.strip('%')
|
||||
for svalue, test in field['selection']:
|
||||
if test.lower().startswith(test_value.lower()):
|
||||
@@ -743,6 +743,7 @@ def test_complete_selection():
|
||||
('', ['male', 'female']),
|
||||
(None, ['male', 'female']),
|
||||
(['male', 'f'], [['male', 'female']]),
|
||||
(['male', None], [['male', 'male'], ['male', 'female']]),
|
||||
):
|
||||
assert list(complete_value(field, value)) == result
|
||||
|
||||
|
||||
Reference in new issue
Block a user