def sell_form_validation_required()

in app/middlewares/form_validation.py [0:0]


def sell_form_validation_required(f):
    """
    A decorator for validating requests with the sell form.
    Returns an error message if validation fails.

    Parameters:
       f (func): The view function to decorate.

    Output:
       decorated (func): The decorated function.
    """
    @wraps(f)
    def decorated(*args, **kwargs):
        sell_form = SellForm()
        if not sell_form.validate():
            return 'Something does not look right. Check your input and try again.', 400

        return f(form=sell_form, *args, **kwargs)
    return decorated