Пример #1
0
    def _validator(form, field):
        if field.data is None:
            return

        if field.data < getMillisecondTimestamp():
            raise ValidationError("Changes may not be scheduled in the past")
Пример #2
0
def is_when_present_and_in_past_validator(what):
    """Validates if scheduled_change_time value i.e. 'when' field value is present in
    input dictionary/object and if its value is in past or not"""
    return what.get("when", None) and int(what.get("when")) < getMillisecondTimestamp()