object in symlink
This commit is contained in:
parent
82e8057e9d
commit
3e2d221cc4
3 changed files with 14 additions and 16 deletions
|
@ -169,10 +169,9 @@ class FamilyAnnotator:
|
||||||
for family in families.family.values():
|
for family in families.family.values():
|
||||||
if 'dynamic' not in vars(family):
|
if 'dynamic' not in vars(family):
|
||||||
continue
|
continue
|
||||||
obj = self.objectspace.paths.get_variable_obj(family.dynamic)
|
family.dynamic = self.objectspace.paths.get_variable_obj(family.dynamic)
|
||||||
if not obj.multi:
|
if not family.dynamic.multi:
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
|
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
|
||||||
msg = _(f'dynamic family "{family.name}" must be linked '
|
msg = _(f'dynamic family "{family.name}" must be linked '
|
||||||
f'to multi variable in {xmlfiles}')
|
f'to multi variable in {xmlfiles}')
|
||||||
raise DictConsistencyError(msg, 16)
|
raise DictConsistencyError(msg, 16)
|
||||||
family.dynamic = obj.path
|
|
||||||
|
|
|
@ -177,13 +177,7 @@ class ServiceAnnotator:
|
||||||
variable.mode = None
|
variable.mode = None
|
||||||
variable.type = type_
|
variable.type = type_
|
||||||
if type_ == 'symlink':
|
if type_ == 'symlink':
|
||||||
variable.opt, suffix = self.objectspace.paths.get_variable_path(value,
|
variable.opt = self.objectspace.paths.get_variable_obj(value)
|
||||||
'services',
|
|
||||||
)
|
|
||||||
if suffix:
|
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(value.xmlfiles)
|
|
||||||
msg = _(f'the "{key}" in services cannot be a dynamic variable in {xmlfiles}')
|
|
||||||
raise DictConsistencyError(msg, 23)
|
|
||||||
variable.multi = None
|
variable.multi = None
|
||||||
else:
|
else:
|
||||||
variable.doc = key
|
variable.doc = key
|
||||||
|
|
|
@ -12,6 +12,10 @@ FORCE_INFORMATIONS = ['help', 'test', 'separator', 'manage']
|
||||||
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
||||||
|
|
||||||
|
|
||||||
|
class Root():
|
||||||
|
path = '.'
|
||||||
|
|
||||||
|
|
||||||
class TiramisuReflector:
|
class TiramisuReflector:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
xmlroot,
|
xmlroot,
|
||||||
|
@ -31,7 +35,7 @@ class TiramisuReflector:
|
||||||
]
|
]
|
||||||
self.make_tiramisu_objects(xmlroot)
|
self.make_tiramisu_objects(xmlroot)
|
||||||
# parse object
|
# parse object
|
||||||
self.storage.get('.').get()
|
self.storage.get(Root()).get()
|
||||||
|
|
||||||
def make_tiramisu_objects(self,
|
def make_tiramisu_objects(self,
|
||||||
xmlroot,
|
xmlroot,
|
||||||
|
@ -152,7 +156,7 @@ class TiramisuReflector:
|
||||||
return subpath + '.' + elt.name
|
return subpath + '.' + elt.name
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
return '\n'.join(self.storage.get('.').get_text())
|
return '\n'.join(self.storage.get(Root()).get_text())
|
||||||
|
|
||||||
|
|
||||||
class BaseElt:
|
class BaseElt:
|
||||||
|
@ -172,7 +176,8 @@ class ElementStorage:
|
||||||
self.paths[path] = (elt, self.index)
|
self.paths[path] = (elt, self.index)
|
||||||
self.index += 1
|
self.index += 1
|
||||||
|
|
||||||
def get(self, path):
|
def get(self, obj):
|
||||||
|
path = obj.path
|
||||||
return self.paths[path][0]
|
return self.paths[path][0]
|
||||||
|
|
||||||
def get_name(self, path):
|
def get_name(self, path):
|
||||||
|
@ -196,7 +201,7 @@ class Common:
|
||||||
def populate_properties(self, child):
|
def populate_properties(self, child):
|
||||||
assert child.type == 'calculation'
|
assert child.type == 'calculation'
|
||||||
action = f"ParamValue('{child.name}')"
|
action = f"ParamValue('{child.name}')"
|
||||||
option_name = self.storage.get(child.source.path).get()
|
option_name = self.storage.get(child.source).get()
|
||||||
kwargs = f"'condition': ParamOption({option_name}, todict=True), 'expected': ParamValue('{child.expected}')"
|
kwargs = f"'condition': ParamOption({option_name}, todict=True), 'expected': ParamValue('{child.expected}')"
|
||||||
if child.inverse:
|
if child.inverse:
|
||||||
kwargs += ", 'reverse_condition': ParamValue(True)"
|
kwargs += ", 'reverse_condition': ParamValue(True)"
|
||||||
|
@ -324,7 +329,7 @@ class Variable(Common):
|
||||||
self.attrib['validators'].append(self.calculation_value(child, ['ParamSelfOption()']))
|
self.attrib['validators'].append(self.calculation_value(child, ['ParamSelfOption()']))
|
||||||
elif tag == 'choice':
|
elif tag == 'choice':
|
||||||
if child.type == 'calculation':
|
if child.type == 'calculation':
|
||||||
value = self.storage.get(child.name.path).get()
|
value = self.storage.get(child.name).get()
|
||||||
choices = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
choices = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
||||||
else:
|
else:
|
||||||
choices.append(child.name)
|
choices.append(child.name)
|
||||||
|
@ -400,7 +405,7 @@ class Variable(Common):
|
||||||
def build_param(self,
|
def build_param(self,
|
||||||
param,
|
param,
|
||||||
):
|
):
|
||||||
option_name = self.storage.get(param['option'].path).get()
|
option_name = self.storage.get(param['option']).get()
|
||||||
if 'suffix' in param:
|
if 'suffix' in param:
|
||||||
family = '.'.join(param['option'].path.split('.')[:-1])
|
family = '.'.join(param['option'].path.split('.')[:-1])
|
||||||
family_option = self.storage.get_name(family)
|
family_option = self.storage.get_name(family)
|
||||||
|
|
Loading…
Reference in a new issue