Compare commits
2 Commits
75a073455e
...
8b4af12217
Author | SHA1 | Date |
---|---|---|
Emmanuel Garette | 8b4af12217 | |
Emmanuel Garette | a5b6352188 |
|
@ -333,14 +333,39 @@ class CalcValue:
|
||||||
value = value[index]
|
value = value[index]
|
||||||
else:
|
else:
|
||||||
value = None
|
value = None
|
||||||
elif None in value and not allow_none:
|
else:
|
||||||
value = []
|
if join is not None:
|
||||||
elif remove_duplicate_value:
|
if None not in value:
|
||||||
new_value = []
|
length_val = None
|
||||||
for val in value:
|
for val in value:
|
||||||
if val not in new_value:
|
if isinstance(val, list):
|
||||||
new_value.append(val)
|
if None in val:
|
||||||
value = new_value
|
length_val = None
|
||||||
|
break
|
||||||
|
lval = len(val)
|
||||||
|
if length_val is not None and length_val != lval:
|
||||||
|
raise ValueError(_(f'unexpected value in calc_value with join attribute "{val}" with invalid length "{length_val}"'))
|
||||||
|
length_val = lval
|
||||||
|
new_value = []
|
||||||
|
for idx in range(length_val):
|
||||||
|
idx_val = []
|
||||||
|
for val in value:
|
||||||
|
if isinstance(val, list):
|
||||||
|
idx_val.append(val[idx])
|
||||||
|
else:
|
||||||
|
idx_val.append(val)
|
||||||
|
new_value.append(join.join(idx_val))
|
||||||
|
value = new_value
|
||||||
|
else:
|
||||||
|
value = []
|
||||||
|
elif None in value and not allow_none:
|
||||||
|
value = []
|
||||||
|
elif remove_duplicate_value:
|
||||||
|
new_value = []
|
||||||
|
for val in value:
|
||||||
|
if val not in new_value:
|
||||||
|
new_value.append(val)
|
||||||
|
value = new_value
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def value_from_kwargs(self,
|
def value_from_kwargs(self,
|
||||||
|
|
Loading…
Reference in New Issue