zenodo_accessrequests/forms.py
def validate_expires_at(form, field):
    """Validate that date is in the future."""
    if form.accept.data:
        if not field.data or datetime.utcnow().date() >= field.data:
            raise validators.StopValidation(_(
                "Please provide a future date."
            ))
        if not field.data or \
                datetime.utcnow().date() + timedelta(days=365) < field.data:
            raise validators.StopValidation(_(
                "Please provide a date no more than 1 year into the future."
            ))
def validate_expires_at(form, field):
    """Validate that date is in the future."""
    if form.accept.data:
        if not field.data or datetime.utcnow().date() >= field.data:
            raise validators.StopValidation(_(
                "Please provide a future date."
            ))
        if not field.data or \
                datetime.utcnow().date() + timedelta(days=365) < field.data:
            raise validators.StopValidation(_(
                "Please provide a date no more than 1 year into the future."
            ))
def validate_expires_at ( form , field ) : if form . accept . data : if not field . data or datetime . utcnow ( ) . date ( ) >= field . data : raise validators . StopValidation ( _ ( "Please provide a future date." ) ) if not field . data or datetime . utcnow ( ) . date ( ) + timedelta ( days = 365 ) < field . data : raise validators . StopValidation ( _ ( "Please provide a date no more than 1 year into the future." ) )
Validate that date is in the future.
Validate that date is in the future .