hack to support valid_network_netmask

This commit is contained in:
Emmanuel Garette 2021-02-28 21:07:36 +01:00
parent b049cb9324
commit 5eeaaedded

View file

@ -267,7 +267,8 @@ class Common:
params = [f'{option_name}'] params = [f'{option_name}']
if hasattr(param, 'suffix'): if hasattr(param, 'suffix'):
param_type = 'ParamDynOption' param_type = 'ParamDynOption'
params.extend([f"'{param.suffix}'", f'{param.family.reflector_name}']) family = param.family.reflector_object.get()
params.extend([f"'{param.suffix}'", f'{family}'])
else: else:
param_type = 'ParamOption' param_type = 'ParamOption'
if not param.propertyerror: if not param.propertyerror:
@ -328,14 +329,22 @@ class Variable(Common):
kwargs = [] kwargs = []
# has parameters # has parameters
function = child.name function = child.name
new_args = []
if hasattr(child, 'param'): if hasattr(child, 'param'):
for param in child.param: for param in child.param:
value = self.populate_param(param) value = self.populate_param(param)
if not hasattr(param, 'name'): if not hasattr(param, 'name'):
args.append(str(value)) # args.append(str(value))
new_args.append(str(value))
else: else:
kwargs.append(f"'{param.name}': " + value) kwargs.append(f"'{param.name}': " + value)
ret = f'Calculation(func.{function}, Params((' + ', '.join(args) + ')' # ret = f'Calculation(func.{function}, Params((' + ', '.join(args) + ')'
if function == 'valid_network_netmask':
new_args.extend(args)
else:
args.extend(new_args)
new_args = args
ret = f'Calculation(func.{function}, Params((' + ', '.join(new_args) + ')'
if kwargs: if kwargs:
ret += ', kwargs={' + ', '.join(kwargs) + '}' ret += ', kwargs={' + ', '.join(kwargs) + '}'
ret += ')' ret += ')'