fix(web): une erreur sur un point JSON ne renvoie plus une page HTML

STD-09, trouve en recroisant l'audit anterieur -- celui mene sur le miroir
GitHub, jamais repasse depuis qu'on a decouvert que ce n'etait pas la bonne
source.

Sept gestionnaires d'erreur portaient chacun leur copie d'une liste de
prefixes d'URL decidant "JSON ou page HTML". Les copies avaient derive --
trois testaient /users/coach-availability, quatre non -- et toutes
manquaient les memes points. Un fetch() qui recoit une page d'erreur HTML
leve en la parsant : sur le calendrier, les listes de selections et
d'equipes restaient vides, sans message dans la page et sans rien dans le
journal.

Deux choses apprises en ecrivant le test, aucune n'etait dans le constat.

L'approche par prefixe ne pouvait pas etre reparee. Trois des seize vues
JSON sont a des chemins qu'aucun prefixe ne distingue des pages HTML
voisines -- /matches/<id>/toggle-presence/<id> et ses deux cousins, que les
gabarits appellent justement en fetch(). Les vues se declarent donc
elles-memes (@json_endpoint, app/api.py), et un test parcourt la carte des
URL pour verifier qu'aucune vue appelant jsonify n'a ete oubliee.

Et surtout : @login_required n'atteint jamais le gestionnaire 401.
Flask-Login intercepte avant et redirige. Les seize points JSON repondaient
donc a une session expiree par une 302 vers un formulaire HTML, quoi que
dise la liste de prefixes. Reecrire la liste seule aurait eu l'air d'un
correctif sans rien changer.

Au passage, le message flash de ce gestionnaire etait la seule chaine de
l'application qui n'avait jamais ete traduite.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
GGThed
2026-08-11 19:36:25 -04:00
co-authored by Claude Opus 5
parent 8d7de75e99
commit ad3dea6a15
11 changed files with 436 additions and 153 deletions
Binary file not shown.
+63 -59
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: team-tryouts VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2026-08-11 15:25-0400\n"
"POT-Creation-Date: 2026-08-11 18:57-0400\n"
"PO-Revision-Date: 2026-08-07 20:22-0400\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
@@ -19,6 +19,10 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.18.0\n"
#: app/app.py:555
msgid "Please log in to access this page."
msgstr "Please log in to access this page."
#: app/forms.py:37 app/routes/auth.py:224 app/routes/auth.py:374
#: app/routes/users/contracts.py:96
#, python-format
@@ -199,11 +203,11 @@ msgstr ""
msgid "Your registration could not be processed. Please try again."
msgstr "Your registration could not be processed. Please try again."
#: app/routes/auth.py:388 app/routes/users/accounts.py:308
#: app/routes/auth.py:388 app/routes/users/accounts.py:325
msgid "Username already exists."
msgstr "Username already exists."
#: app/routes/auth.py:392 app/routes/users/accounts.py:312
#: app/routes/auth.py:392 app/routes/users/accounts.py:329
msgid "Email already registered."
msgstr "Email already registered."
@@ -275,9 +279,9 @@ msgstr "Evaluation submitted successfully!"
msgid "Evaluation updated!"
msgstr "Evaluation updated!"
#: app/routes/evaluations.py:210 app/routes/teams.py:270
#: app/routes/teams.py:311 app/routes/teams.py:352 app/routes/teams.py:377
#: app/routes/teams.py:402 app/routes/teams.py:437 app/routes/tryouts.py:437
#: app/routes/evaluations.py:210 app/routes/teams.py:289
#: app/routes/teams.py:330 app/routes/teams.py:371 app/routes/teams.py:396
#: app/routes/teams.py:421 app/routes/teams.py:456 app/routes/tryouts.py:437
#: app/routes/tryouts.py:453 app/routes/tryouts.py:473
#: app/routes/tryouts.py:512 app/routes/tryouts.py:548
#: app/routes/tryouts.py:567
@@ -288,183 +292,183 @@ msgstr "Permission denied."
msgid "That language is not available."
msgstr "That language is not available."
#: app/routes/matches.py:361
#: app/routes/matches.py:364
msgid "You do not have permission to schedule matches for this tryout."
msgstr "You do not have permission to schedule matches for this tryout."
#: app/routes/matches.py:365 app/routes/matches.py:445
#: app/routes/matches.py:368 app/routes/matches.py:448
msgid "This tryout has ended. Matches can no longer be created or modified."
msgstr "This tryout has ended. Matches can no longer be created or modified."
#: app/routes/matches.py:427
#: app/routes/matches.py:430
msgid "Match scheduled successfully!"
msgstr "Match scheduled successfully!"
#: app/routes/matches.py:441 app/routes/team_matches.py:211
#: app/routes/matches.py:444 app/routes/team_matches.py:212
msgid "You do not have permission to edit this match."
msgstr "You do not have permission to edit this match."
#: app/routes/matches.py:536 app/routes/team_matches.py:241
#: app/routes/matches.py:539 app/routes/team_matches.py:242
msgid "Match updated successfully!"
msgstr "Match updated successfully!"
#: app/routes/matches.py:571 app/routes/team_matches.py:256
#: app/routes/matches.py:575 app/routes/team_matches.py:257
msgid "You do not have permission to delete this match."
msgstr "You do not have permission to delete this match."
#: app/routes/matches.py:574
#: app/routes/matches.py:578
msgid "This tryout has ended. Matches can no longer be deleted."
msgstr "This tryout has ended. Matches can no longer be deleted."
#: app/routes/matches.py:587 app/routes/team_matches.py:260
#: app/routes/matches.py:591 app/routes/team_matches.py:261
msgid "Match deleted successfully."
msgstr "Match deleted successfully."
#: app/routes/team_matches.py:104
#: app/routes/team_matches.py:105
msgid "You do not have permission to schedule matches for this team."
msgstr "You do not have permission to schedule matches for this team."
#: app/routes/team_matches.py:196
#: app/routes/team_matches.py:197
#, python-format
msgid "Team match \"%(title)s\" scheduled successfully!"
msgstr "Team match \"%(title)s\" scheduled successfully!"
#: app/routes/teams.py:40
#: app/routes/teams.py:41
msgid "Use My Team(s) to view your teams."
msgstr "Use My Team(s) to view your teams."
#: app/routes/teams.py:43
#: app/routes/teams.py:44
msgid "You do not have permission to view teams."
msgstr "You do not have permission to view teams."
#: app/routes/teams.py:70
#: app/routes/teams.py:71
msgid "This page is for players."
msgstr "This page is for players."
#: app/routes/teams.py:123
#: app/routes/teams.py:124
msgid "You do not have permission to create teams."
msgstr "You do not have permission to create teams."
#: app/routes/teams.py:131 app/routes/teams.py:176
#: app/routes/teams.py:132 app/routes/teams.py:177
msgid "Team name is required."
msgstr "Team name is required."
#: app/routes/teams.py:136 app/routes/teams.py:181
#: app/routes/teams.py:137 app/routes/teams.py:182
#, python-format
msgid "Team \"%(name)s\" already exists."
msgstr "Team \"%(name)s\" already exists."
#: app/routes/teams.py:158
#: app/routes/teams.py:159
#, python-format
msgid "Team \"%(name)s\" created successfully!"
msgstr "Team \"%(name)s\" created successfully!"
#: app/routes/teams.py:168
#: app/routes/teams.py:169
msgid "You do not have permission to edit this team."
msgstr "You do not have permission to edit this team."
#: app/routes/teams.py:219
#: app/routes/teams.py:220
#, python-format
msgid "Team \"%(name)s\" updated successfully!"
msgstr "Team \"%(name)s\" updated successfully!"
#: app/routes/teams.py:228
#: app/routes/teams.py:248
msgid "You do not have permission to delete teams."
msgstr "You do not have permission to delete teams."
#: app/routes/teams.py:260
#: app/routes/teams.py:279
#, python-format
msgid "Team \"%(name)s\" deleted successfully."
msgstr "Team \"%(name)s\" deleted successfully."
#: app/routes/teams.py:275
#: app/routes/teams.py:294
msgid "Please select a coach."
msgstr "Please select a coach."
#: app/routes/teams.py:280
#: app/routes/teams.py:299
msgid "Only coaches can be assigned as coach."
msgstr "Only coaches can be assigned as coach."
#: app/routes/teams.py:286
#: app/routes/teams.py:305
#, python-format
msgid "%(username)s is already a coach of %(name)s."
msgstr "%(username)s is already a coach of %(name)s."
#: app/routes/teams.py:299
#: app/routes/teams.py:318
#, python-format
msgid "%(username)s added as coach of %(name)s."
msgstr "%(username)s added as coach of %(name)s."
#: app/routes/teams.py:316
#: app/routes/teams.py:335
msgid "Please select a manager."
msgstr "Please select a manager."
#: app/routes/teams.py:321
#: app/routes/teams.py:340
msgid "Only managers can be assigned as manager."
msgstr "Only managers can be assigned as manager."
#: app/routes/teams.py:327
#: app/routes/teams.py:346
#, python-format
msgid "%(username)s is already a manager of %(name)s."
msgstr "%(username)s is already a manager of %(name)s."
#: app/routes/teams.py:340
#: app/routes/teams.py:359
#, python-format
msgid "%(username)s added as manager of %(name)s."
msgstr "%(username)s added as manager of %(name)s."
#: app/routes/teams.py:367
#: app/routes/teams.py:386
#, python-format
msgid "Coach removed from %(name)s."
msgstr "Coach removed from %(name)s."
#: app/routes/teams.py:392
#: app/routes/teams.py:411
#, python-format
msgid "Manager removed from %(name)s."
msgstr "Manager removed from %(name)s."
#: app/routes/teams.py:408 app/routes/tryouts.py:477 app/routes/tryouts.py:578
#: app/routes/teams.py:427 app/routes/tryouts.py:477 app/routes/tryouts.py:578
msgid "Please select a player."
msgstr "Please select a player."
#: app/routes/teams.py:413
#: app/routes/teams.py:432
msgid "Can only assign players to teams."
msgstr "Can only assign players to teams."
#: app/routes/teams.py:419
#: app/routes/teams.py:438
#, python-format
msgid "%(username)s is already on %(name)s."
msgstr "%(username)s is already on %(name)s."
#: app/routes/teams.py:427
#: app/routes/teams.py:446
#, python-format
msgid "%(username)s added to %(name)s!"
msgstr "%(username)s added to %(name)s!"
#: app/routes/teams.py:444 app/routes/teams.py:517
#: app/routes/teams.py:463 app/routes/teams.py:537
#, python-format
msgid "%(username)s is not on %(name)s."
msgstr "%(username)s is not on %(name)s."
#: app/routes/teams.py:452
#: app/routes/teams.py:471
#, python-format
msgid "%(username)s removed from %(name)s."
msgstr "%(username)s removed from %(name)s."
#: app/routes/teams.py:488 app/routes/teams.py:506
#: app/routes/teams.py:508 app/routes/teams.py:526
msgid "You do not have permission to add notes to this team."
msgstr "You do not have permission to add notes to this team."
#: app/routes/teams.py:496
#: app/routes/teams.py:516
msgid "Team notes added successfully!"
msgstr "Team notes added successfully!"
#: app/routes/teams.py:511 app/routes/users/notes.py:207
#: app/routes/teams.py:531 app/routes/users/notes.py:207
#: app/routes/users/notes.py:250
msgid "Can only add notes for players."
msgstr "Can only add notes for players."
#: app/routes/teams.py:527
#: app/routes/teams.py:547
#, python-format
msgid "Note added for %(username)s!"
msgstr "Note added for %(username)s!"
@@ -578,23 +582,23 @@ msgstr "Only PDF files are allowed for contracts."
msgid "That file is not a PDF, whatever its name says."
msgstr "That file is not a PDF, whatever its name says."
#: app/routes/users/accounts.py:53
#: app/routes/users/accounts.py:54
msgid "Only the president can manage users."
msgstr "Only the president can manage users."
#: app/routes/users/accounts.py:65
#: app/routes/users/accounts.py:66
msgid "Only the president can edit users."
msgstr "Only the president can edit users."
#: app/routes/users/accounts.py:106
#: app/routes/users/accounts.py:107
msgid "Email already in use by another account."
msgstr "Email already in use by another account."
#: app/routes/users/accounts.py:117
#: app/routes/users/accounts.py:118
msgid "You cannot change your own role. Ask another president to do it."
msgstr "You cannot change your own role. Ask another president to do it."
#: app/routes/users/accounts.py:130
#: app/routes/users/accounts.py:131
msgid ""
"This is the last active president. Promote another account before "
"changing this one."
@@ -602,34 +606,34 @@ msgstr ""
"This is the last active president. Promote another account before "
"changing this one."
#: app/routes/users/accounts.py:209
#: app/routes/users/accounts.py:210
#, python-format
msgid "User %(username)s updated successfully!"
msgstr "User %(username)s updated successfully!"
#: app/routes/users/accounts.py:230
#: app/routes/users/accounts.py:231
msgid "Only the president can delete users."
msgstr "Only the president can delete users."
#: app/routes/users/accounts.py:234
#: app/routes/users/accounts.py:235
msgid "You cannot delete your own account."
msgstr "You cannot delete your own account."
#: app/routes/users/accounts.py:277
#: app/routes/users/accounts.py:294
#, python-format
msgid "User %(deleted_username)s has been removed."
msgstr "User %(deleted_username)s has been removed."
#: app/routes/users/accounts.py:288
#: app/routes/users/accounts.py:305
msgid "Only the president can create users."
msgstr "Only the president can create users."
#: app/routes/users/accounts.py:336
#: app/routes/users/accounts.py:353
#, python-format
msgid "User %(full_name)s created as %(role)s!"
msgstr "User %(full_name)s created as %(role)s!"
#: app/routes/users/availability.py:179
#: app/routes/users/availability.py:187
msgid "Only coaches can manage availability."
msgstr "Only coaches can manage availability."