Created
October 13, 2018 14:22
-
-
Save jtemporal/f6d51d209641b32782959e1a351dd2b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from schematics.types import IntType | |
from schematics.exceptions import ValidationError | |
class SizedNumberType(IntType): | |
def validate_number(self, number): | |
sized = str(number) | |
if len(sized) != 2: | |
raise ValidationError("This number doesn't comply with the expected format size 2") | |
return number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment