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():
|
||||
if 'dynamic' not in vars(family):
|
||||
continue
|
||||
obj = self.objectspace.paths.get_variable_obj(family.dynamic)
|
||||
if not obj.multi:
|
||||
family.dynamic = self.objectspace.paths.get_variable_obj(family.dynamic)
|
||||
if not family.dynamic.multi:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
|
||||
msg = _(f'dynamic family "{family.name}" must be linked '
|
||||
f'to multi variable in {xmlfiles}')
|
||||
raise DictConsistencyError(msg, 16)
|
||||
family.dynamic = obj.path
|
||||
|
|
|
@ -177,13 +177,7 @@ class ServiceAnnotator:
|
|||
variable.mode = None
|
||||
variable.type = type_
|
||||
if type_ == 'symlink':
|
||||
variable.opt, suffix = self.objectspace.paths.get_variable_path(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.opt = self.objectspace.paths.get_variable_obj(value)
|
||||
variable.multi = None
|
||||
else:
|
||||
variable.doc = key
|
||||
|
|
|
@ -12,6 +12,10 @@ FORCE_INFORMATIONS = ['help', 'test', 'separator', 'manage']
|
|||
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
||||
|
||||
|
||||
class Root():
|
||||
path = '.'
|
||||
|
||||
|
||||
class TiramisuReflector:
|
||||
def __init__(self,
|
||||
xmlroot,
|
||||
|
@ -31,7 +35,7 @@ class TiramisuReflector:
|
|||
]
|
||||
self.make_tiramisu_objects(xmlroot)
|
||||
# parse object
|
||||
self.storage.get('.').get()
|
||||
self.storage.get(Root()).get()
|
||||
|
||||
def make_tiramisu_objects(self,
|
||||
xmlroot,
|
||||
|
@ -152,7 +156,7 @@ class TiramisuReflector:
|
|||
return subpath + '.' + elt.name
|
||||
|
||||
def get_text(self):
|
||||
return '\n'.join(self.storage.get('.').get_text())
|
||||
return '\n'.join(self.storage.get(Root()).get_text())
|
||||
|
||||
|
||||
class BaseElt:
|
||||
|
@ -172,7 +176,8 @@ class ElementStorage:
|
|||
self.paths[path] = (elt, self.index)
|
||||
self.index += 1
|
||||
|
||||
def get(self, path):
|
||||
def get(self, obj):
|
||||
path = obj.path
|
||||
return self.paths[path][0]
|
||||
|
||||
def get_name(self, path):
|
||||
|
@ -196,7 +201,7 @@ class Common:
|
|||
def populate_properties(self, child):
|
||||
assert child.type == 'calculation'
|
||||
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}')"
|
||||
if child.inverse:
|
||||
kwargs += ", 'reverse_condition': ParamValue(True)"
|
||||
|
@ -324,7 +329,7 @@ class Variable(Common):
|
|||
self.attrib['validators'].append(self.calculation_value(child, ['ParamSelfOption()']))
|
||||
elif tag == 'choice':
|
||||
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}))))"
|
||||
else:
|
||||
choices.append(child.name)
|
||||
|
@ -400,7 +405,7 @@ class Variable(Common):
|
|||
def build_param(self,
|
||||
param,
|
||||
):
|
||||
option_name = self.storage.get(param['option'].path).get()
|
||||
option_name = self.storage.get(param['option']).get()
|
||||
if 'suffix' in param:
|
||||
family = '.'.join(param['option'].path.split('.')[:-1])
|
||||
family_option = self.storage.get_name(family)
|
||||
|
|
Loading…
Reference in a new issue