add long-Type to allowed datatypes of 'utc-millisec' formatted numbers
matthiasgleichauf opened this issue · 0 comments
matthiasgleichauf commented
Currently, 'utc-millisec' formatted numbers are only allowed to be of type int and float.
So
{"created":1346691273926}
cannot be validated by a schema like:
{"type":"number","format":"utc-millisec"}
I propose the following patch to allow the (in my eyes valid) data to be validated:
diff --git a/validictory/validator.py b/validictory/validator.py
index 8e81d58..f17d7f1 100755
--- a/validictory/validator.py
+++ b/validictory/validator.py
@@ -44,7 +44,7 @@ validate_format_time = _generate_datetime_validator('time', '%H:%M:%S')
def validate_format_utc_millisec(validator, fieldname, value, format_option):
- if not isinstance(value, (int, float)):
+ if not isinstance(type(value), _int_types):
raise ValidationError("Value %(value)r of field '%(fieldname)s' is "
"not a number" % locals())