notunique and notempty support
This commit is contained in:
parent
6b77b0c5ad
commit
d3e99cc9a5
1 changed files with 11 additions and 4 deletions
|
@ -70,9 +70,16 @@ class Base:
|
||||||
properties = frozenset()
|
properties = frozenset()
|
||||||
elif isinstance(properties, tuple):
|
elif isinstance(properties, tuple):
|
||||||
properties = frozenset(properties)
|
properties = frozenset(properties)
|
||||||
if is_multi and 'empty' not in properties:
|
if is_multi:
|
||||||
# if option is a multi, it cannot be "empty" (None not allowed in the list)
|
# if option is a multi, it cannot be 'empty' (None not allowed in the list) and cannot have multiple time the same value
|
||||||
# "empty" is removed for follower's option
|
# 'empty' and 'unique' are removed for follower's option
|
||||||
|
if 'notunique' in properties:
|
||||||
|
properties = properties - {'notunique'}
|
||||||
|
else:
|
||||||
|
properties = properties | {'unique'}
|
||||||
|
if 'notempty' in properties:
|
||||||
|
properties = properties - {'notempty'}
|
||||||
|
else:
|
||||||
properties = properties | {'empty'}
|
properties = properties | {'empty'}
|
||||||
assert isinstance(properties, frozenset), _('invalid properties type {0} for {1},'
|
assert isinstance(properties, frozenset), _('invalid properties type {0} for {1},'
|
||||||
' must be a frozenset').format(type(properties),
|
' must be a frozenset').format(type(properties),
|
||||||
|
|
Loading…
Reference in a new issue