Commit 1cc324f0 authored by Michele Tartara's avatar Michele Tartara
Browse files

Warn instead of crashing on preexisting wrong data type

Using None in a VTYPE_MAYBE_STRING is wrong, because it cannot really
be serialized to a Haskel Nothing, but given that this can (and does)
influence external components already using None, it is turned to a
warning in order not to break the existing behavior.
Signed-off-by: default avatarMichele Tartara <>
Reviewed-by: default avatarHelga Velroyen <>
parent b17dd379
......@@ -99,7 +99,7 @@ def ForceDictType(target, key_types, allowed_values=None):
if ktype in (constants.VTYPE_STRING, constants.VTYPE_MAYBE_STRING):
if target[key] is None and ktype == constants.VTYPE_MAYBE_STRING:
msg = "'None' is not a valid Maybe value. Use 'VALUE_HS_NOTHING'"
raise errors.TypeEnforcementError(msg)
elif (target[key] == constants.VALUE_HS_NOTHING
and ktype == constants.VTYPE_MAYBE_STRING):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment