if must_keys and (key in must_keys):
del copy_must[copy_must.index(key)] # Remove the key from copied list
elif (must_keys and (key not in must_keys) and (other_keys and (key not in other_keys))) or (other_keys and (key not in other_keys)):
- raise KeyError, "field key \"" + key + "\" is not in list of allowed keys"
+ raise KeyError("field key \"" + key + "\" is not in list of allowed keys")
if copy_must: # If there is at least one key - it is an error:
# not all "must" keys are in record
- raise KeyError, "not all \"must\" keys are in record; keys: " + str(copy_must)
+ raise KeyError("not all \"must\" keys are in record; keys: " + str(copy_must))
return 1