%global commit 7fa5a26946d2fdb5b00d07251c0ca7d0e358fc1d %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: flask-wtf-decorators Version: 0.1.2 Release: 20200702.%{shortcommit}%{?dist} Summary: Use decorators to validate forms BuildArch: noarch License: MIT URL: https://github.com/simpleapples/flask-wtf-decorators Source0: https://github.com/simpleapples/flask-wtf-decorators/archive/%{commit}/%{name}-%{shortcommit}.tar.gz BuildRequires: python3-devel Requires: python3-flask %description Flask-WTF-Decorators is easy to use. You can define a view that requires validation. from flask-wtf-decorators import FormValidator form_validator = FormValidator() @form_validator.validate_form(TestForm) @app.route('/', methods=['GET', 'POST']) def index(form): pass You can tell Flask-WTF-Decorators what to do when a form is illegal. To do this you should provide a callback for error_handler. @form_validator.error_handler def error_handler(errors): return jsonify({'errors': errors}), 400 %prep %autosetup -n %{name}-%{commit} %build %py3_build %install %py3_install %files %license LICENSE.txt %doc README.md %{python3_sitelib}/flask_wtf_decorators %{python3_sitelib}/Flask_WTF_Decorators-*.egg-info/ %changelog * Thu Jul 02 2020 Jakub Kadlčík - Initial package