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}']
if hasattr(param, 'suffix'):
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:
param_type = 'ParamOption'
if not param.propertyerror:
@ -328,14 +329,22 @@ class Variable(Common):
kwargs = []
# has parameters
function = child.name
new_args = []
if hasattr(child, 'param'):
for param in child.param:
value = self.populate_param(param)
if not hasattr(param, 'name'):
args.append(str(value))
# args.append(str(value))
new_args.append(str(value))
else:
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:
ret += ', kwargs={' + ', '.join(kwargs) + '}'
ret += ')'