remove_choice only avalable for choice
This commit is contained in:
parent
8d32ec9f01
commit
20f329d433
|
@ -393,7 +393,7 @@ class RougailObjSpace:
|
|||
for attr, val in child.attrib.items():
|
||||
if redefine and attr in UNREDEFINABLE:
|
||||
msg = _(f'cannot redefine attribute "{attr}" for variable "{child.attrib["name"]}"'
|
||||
f' in "{xmlfile}", already defined')
|
||||
f' already defined')
|
||||
raise DictConsistencyError(msg, 48, variableobj.xmlfiles[:-1])
|
||||
if attr in self.booleans_attributs:
|
||||
val = convert_boolean(val)
|
||||
|
@ -411,6 +411,10 @@ class RougailObjSpace:
|
|||
"""
|
||||
if child.tag == 'variable':
|
||||
if child.attrib.get('remove_choice', False):
|
||||
if variableobj.type != 'choice':
|
||||
msg = _(f'cannot remove choices for variable "{variableobj.path}"'
|
||||
f' the variable has type "{variableobj.type}"')
|
||||
raise DictConsistencyError(msg, 33, variableobj.xmlfiles)
|
||||
variableobj.choice = []
|
||||
if child.attrib.get('remove_check', False):
|
||||
self.remove_check(variableobj.name)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<variable name="enumvar" type="string"/>
|
||||
</variables>
|
||||
<constraints/>
|
||||
</rougail>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail version="0.10">
|
||||
<variables>
|
||||
<variable name="enumvar" redefine="True" remove_choice="True"/>
|
||||
</variables>
|
||||
<constraints/>
|
||||
</rougail>
|
||||
|
Loading…
Reference in New Issue