allow 'variable' in dynamic family in 1.1

This commit is contained in:
egarette@silique.fr 2024-07-29 12:04:31 +02:00
parent 085840449c
commit 560deb52b6
2 changed files with 4 additions and 5 deletions

View file

@ -480,7 +480,7 @@ class ParserVariable:
return
family_obj = {}
subfamily_obj = {}
force_to_attrs = list(self.list_attributes(obj))
force_to_attrs = list(self.list_attributes(obj, version))
for key, value in obj.items():
if key in force_to_attrs:
if key.startswith("_"):
@ -558,6 +558,7 @@ class ParserVariable:
def list_attributes(
self,
obj: Dict[str, Any],
version: str,
) -> Iterator[str]:
"""List attributes"""
force_to_variable = []
@ -580,8 +581,7 @@ class ParserVariable:
):
# it's a dict, so a new variables!
continue
# FIXME should be remove with 1.0 format
if key == "variable" and obj.get("type") != "dynamic":
if version == '1.0' and key == "variable" and obj.get("type") != "dynamic" and obj.get("_type") != "dynamic":
continue
if key in self.family_attrs:
yield key

View file

@ -35,9 +35,8 @@ except ModuleNotFoundError as err:
# from ast import parse as ast_parse
from json import dumps
from pathlib import Path
from ruamel.yaml import YAML
from pathlib import Path
from .config import RougailConfig
from .error import UpgradeError