Bug #48132
ValueError: unconverted data remains: h00
Début:
29 octobre 2020
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
https://sentry.entrouvert.org/entrouvert/publik/issues/6028/
Sur un appel à https://agendas-....test.entrouvert.org/api/agenda/cabines-simples/fillslot/creneau:2020-10-28-14h00/
ValueError: unconverted data remains: h00 (7 additional frame(s) were not displayed) ... File "rest_framework/views.py", line 492, in dispatch response = handler(request, *args, **kwargs) File "chrono/api/views.py", line 1086, in post format=format, File "chrono/api/views.py", line 835, in fillslot datetimes.add(make_aware(datetime.datetime.strptime(datetime_str, '%Y-%m-%d-%H%M'))) File "_strptime.py", line 577, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "_strptime.py", line 362, in _strptime data_string[found.end():])
mais je ne sais trop comment l'URL a pu être construite, ce serait à voir, si ça n'a pas été construit à la main il y a à creuser davantage, mais si c'est bien juste créé à la main, il y aurait juste à lever APIError si le strptime() échoue, je pense.
Fichiers
Révisions associées
Historique
Mis à jour par Lauréline Guérin il y a plus de 3 ans
- Fichier 0001-api-proper-error-if-datetime-part-is-wrong-in-a-slot.patch 0001-api-proper-error-if-datetime-part-is-wrong-in-a-slot.patch ajouté
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
Mis à jour par Benjamin Dauvergne il y a plus de 3 ans
- Statut changé de Solution proposée à Solution validée
Par pédanterie j'aurai mis le strptime tout seul dans le try/except sans savoir vraiment si les deux autres appels pourraient faire un ValueError, alors go.
Mis à jour par Lauréline Guérin il y a plus de 3 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit 241d65612b3569da7fd518d2d387169d77fee00b Author: Lauréline Guérin <zebuline@entrouvert.com> Date: Mon Nov 9 09:22:35 2020 +0100 api: proper error if datetime part is wrong in a slot (#48132)
Mis à jour par Frédéric Péters il y a plus de 3 ans
- Statut changé de Résolu (à déployer) à Solution déployée
api: proper error if datetime part is wrong in a slot (#48132)