testingwebapp fixes, weeek tasks 2948-2958

This commit is contained in:
Константин Лебединский
2026-05-04 21:29:23 +05:00
parent 0229bc250b
commit 1ea83aa6b4
9 changed files with 1035 additions and 214 deletions
+7
View File
@@ -11,6 +11,7 @@ import secrets
from datetime import timedelta
from flask import Flask, jsonify, render_template, request
from werkzeug.exceptions import RequestEntityTooLarge
_ROLE_LABELS = {
@@ -89,6 +90,12 @@ def create_app() -> Flask:
'format_role': _format_role,
}
@app.errorhandler(RequestEntityTooLarge)
def _payload_too_large(_e):
if _is_api_path():
return jsonify(error='Файл слишком большой (лимит загрузки на сервере).'), 413
return ('Файл слишком большой.', 413, {'Content-Type': 'text/plain; charset=utf-8'})
@app.errorhandler(404)
def _not_found(_e):
if _is_api_path():