When creating a Python script in Chameleon, you may need to know whether the data contained in the value variable exists or is valid. The 5.0 parser engine defines a variable named value_state that provides this information.
The following table lists the possible values of value_state and what they mean:
If value_state is:
The data in the value variable is:
0
Valid
1
Present But Null
2
Empty
3
Invalid
The following example shows how to use the value_state variable to check the state of the value
variable:
if value_state == 0:
print "value is valid"
elif value_state == 1:
print "value is present but null"
elif value_state == 2:
print "value is empty"
else:
print "value is invalid"
To use the value_state variable, the Chameleon parser you are using
must be version 5.0 or later. In older versions of the parser, this variable is not defined.