Move VERIFY_CODE_TYPES outside the class and use it in the schema

This commit is contained in:
Rebecca Law
2016-02-01 10:54:32 +00:00
parent cec0d40e5b
commit 0b62005983
2 changed files with 6 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ class JobSchema(BaseSchema):
class RequestVerifyCodeSchema(ma.Schema):
def verify_code_type(self):
if self not in ['sms', 'email']:
if self not in models.VERIFY_CODE_TYPES:
raise ValidationError('Invalid code type')
code_type = fields.Str(required=True, validate=verify_code_type)