remove variable in param and remove check

This commit is contained in:
Emmanuel Garette 2021-03-08 06:52:49 +01:00
parent e11105db32
commit 6a12504e8c
1 changed files with 6 additions and 0 deletions

View File

@ -167,6 +167,9 @@ class RougailUpgrade:
raise UpgradeError(_(f'cannot convert param with type "{type}"')) raise UpgradeError(_(f'cannot convert param with type "{type}"'))
if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib: if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib:
subsubsubelement.attrib['type'] = 'number' subsubsubelement.attrib['type'] = 'number'
if (not type or type == 'variable') and subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []):
subsubelement.remove(subsubsubelement)
continue
if subsubelement.attrib['name'] == 'valid_enum' and not type: if subsubelement.attrib['name'] == 'valid_enum' and not type:
if subsubsubelement.attrib.get('name') == 'checkval': if subsubsubelement.attrib.get('name') == 'checkval':
raise UpgradeError(_('checkval in valid_enum is no more supported')) raise UpgradeError(_('checkval in valid_enum is no more supported'))
@ -244,6 +247,9 @@ class RougailUpgrade:
if subsubelement.tag == 'fill' and subsubelement.attrib['target'] in upgrade_help.get('fills', {}).get('remove', []): if subsubelement.tag == 'fill' and subsubelement.attrib['target'] in upgrade_help.get('fills', {}).get('remove', []):
subelement.remove(subsubelement) subelement.remove(subsubelement)
continue continue
if subsubelement.tag == 'check' and subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('remove', []):
subelement.remove(subsubelement)
continue
if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []): if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []):
subelement.remove(subsubelement) subelement.remove(subsubelement)
continue continue