Small addition to patterns.py

stix2.1
Emmanuelle Vargas-Gonzalez 2018-07-06 14:08:49 -04:00
parent 5be1636b10
commit 52c1850655
1 changed files with 3 additions and 3 deletions

View File

@ -64,8 +64,8 @@ class BooleanConstant(_Constant):
self.value = value self.value = value
return return
trues = ['true', 't'] trues = ['true', 't', '1']
falses = ['false', 'f'] falses = ['false', 'f', '0']
try: try:
if value.lower() in trues: if value.lower() in trues:
self.value = True self.value = True
@ -112,7 +112,7 @@ class HashConstant(StringConstant):
vocab_key = _HASH_REGEX[key][1] vocab_key = _HASH_REGEX[key][1]
if not re.match(_HASH_REGEX[key][0], value): if not re.match(_HASH_REGEX[key][0], value):
raise ValueError("'%s' is not a valid %s hash" % (value, vocab_key)) raise ValueError("'%s' is not a valid %s hash" % (value, vocab_key))
self.value = value super(HashConstant, self).__init__(value)
class BinaryConstant(_Constant): class BinaryConstant(_Constant):