Show More
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2010-2020 RhodeCode GmbH |
|
4 | 3 | # |
@@ -90,17 +89,18 b' def UniqueList(localizer, convert=None):' | |||
|
90 | 89 | """ |
|
91 | 90 | Unique List ! |
|
92 | 91 | """ |
|
92 | accept_iterator = True | |
|
93 | ||
|
93 | 94 | messages = { |
|
94 | 95 | 'empty': _('Value cannot be an empty list'), |
|
95 | 96 | 'missing_value': _('Value cannot be an empty list'), |
|
96 | 97 | } |
|
97 | 98 | |
|
98 | 99 | def _convert_to_python(self, value, state): |
|
99 | ret_val = [] | |
|
100 | 100 | |
|
101 | def make_unique(value): | |
|
101 | def make_unique(_value): | |
|
102 | 102 | seen = [] |
|
103 | return [c for c in value if not (c in seen or seen.append(c))] | |
|
103 | return [c for c in _value if not (c in seen or seen.append(c))] | |
|
104 | 104 | |
|
105 | 105 | if isinstance(value, list): |
|
106 | 106 | ret_val = make_unique(value) |
@@ -119,6 +119,7 b' def UniqueList(localizer, convert=None):' | |||
|
119 | 119 | |
|
120 | 120 | def empty_value(self, value): |
|
121 | 121 | return [] |
|
122 | ||
|
122 | 123 | return _validator |
|
123 | 124 | |
|
124 | 125 |
General Comments 0
You need to be logged in to leave comments.
Login now