todict in valid_not_equal

This commit is contained in:
Emmanuel Garette 2020-02-18 22:12:55 +01:00
parent 9bb1a8c26a
commit d139862568
3 changed files with 13 additions and 7 deletions

View File

@ -143,6 +143,7 @@
<!ATTLIST variable mode (basic|normal|expert) "normal">
<!ATTLIST variable remove_check (True|False) "False">
<!ATTLIST variable remove_condition (True|False) "False">
<!ATTLIST variable test CDATA #IMPLIED>
<!ELEMENT separators (separator*)>

View File

@ -25,6 +25,9 @@ from .utils import normalize_family
import imp
FUNC_TO_DICT = ['valid_not_equal']
class ConvertDynOptionDescription(DynOptionDescription):
def convert_suffix_to_path(self, suffix):
return normalize_family(suffix,
@ -323,7 +326,7 @@ class Variable(Common):
value = submulti
else:
raise CreoleLoaderError(_('unknown value {} for {}').format(value, key))
if key == 'help':
if key in ['help', 'test']:
self.add_information(key, value)
elif key == 'type':
pass
@ -357,7 +360,7 @@ class Variable(Common):
self.attrib['properties'].append(child.text)
elif child.tag == 'value':
if child.attrib.get('type') == 'calculation':
if child.text.strip():
if child.text is not None and child.text.strip():
self.attrib['default'] = (child.text.strip(),)
else:
params = []
@ -457,6 +460,9 @@ class Variable(Common):
if len(value) == 3:
for param in value[1]:
if isinstance(param[1], list):
if value[0] in FUNC_TO_DICT:
param_value = ParamOption(self.storage.get(param[1][0]).get(), notraisepropertyerror=param[1][1], todict=True)
else:
param_value = ParamOption(self.storage.get(param[1][0]).get(), notraisepropertyerror=param[1][1])
else:
param_value = ParamValue(param[1])

View File

@ -122,7 +122,6 @@ class CheetahTemplate(ChtTemplate):
"""Initialize Creole CheetahTemplate
"""
extra_context = {'is_defined' : IsDefined(context),
# 'creole_client' : CreoleClient(config),
'normalize_family': normalize_family,
'rougail_filename': destfilename
}
@ -138,9 +137,9 @@ class CreoleLeader:
"""
On rend la variable itérable pour pouvoir faire:
for ip in iplist:
print ip.network
print ip.netmask
print ip
print(ip.network)
print(ip.netmask)
print(ip)
index is used for CreoleLint
"""
self._value = value