Enabling hex serial numbers without breaking backward compatibility. (#779)

* Enabling hex serial numbers without breaking backward compatibility.

* Fixing tests.
This commit is contained in:
kevgliss
2017-05-05 11:04:09 -07:00
committed by GitHub
parent 381cd2e1ff
commit 9c9ca37586
4 changed files with 19 additions and 9 deletions

View File

@ -19,6 +19,16 @@ from marshmallow.fields import Field
from marshmallow.exceptions import ValidationError
class Hex(Field):
"""
A hex formatted string.
"""
def _serialize(self, value, attr, obj):
if value:
value = hex(int(value))[2:].upper()
return value
class ArrowDateTime(Field):
"""A formatted datetime string in UTC.