Bug #25263
restauration de saisie agent sur une page au-delà de la dernière
Début:
13 juillet 2018
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Description
Dans #25262,
Exception: type = '<type 'exceptions.IndexError'>', value = 'list index out of range' Stack trace (most recent call first): File "/usr/lib/python2.7/dist-packages/wcs/forms/root.py", line 644, in _q_index 642 else: 643 page_no = 0 > 644 return self.page(self.pages[page_no], True) 645 self.feed_current_data(None) 646 if not self.pages: REQUEST_METHOD 'GET' REQUEST_URI '/backoffice/submission/demande-pmi/?mt=fb405124ec3fcbb1'
À inspecter le contenu,
page_ids = ['10', '30', '11', '81', '77', '45'] page_no = 7 pages = [<wcs.fields.PageField object at 0x7f032089a050>, <wcs.fields.PageField object at 0x7f0323ea7050>, <wcs.fields.PageField object at 0x7f0323ea7210>, <wcs.fields.PageField object at 0x7f0323ea7390>, <wcs.fields.PageField object at 0x7f0323ea7550>, <wcs.fields.PageField object at 0x7f0323ea7750>]
Je ne sais pas trop encore comment ce page_no arrive.
Mais la situation était anticipée ainsi :
if page_no == -1 or page_no >= self.page_number:
sauf que page_number, c'est vraiment le nombre absolu total de pages, avec des pages conditionnelles ça ne va pas être bon.
Fichiers
Révisions associées
Historique
Mis à jour par Frédéric Péters il y a presque 6 ans
- Fichier 0001-forms-use-proper-pages-calculation-to-know-if-page-n.patch 0001-forms-use-proper-pages-calculation-to-know-if-page-n.patch ajouté
- Statut changé de Nouveau à En cours
Patch qui est posé sur la prod maintenant.
L'origine j'imagine, on fait +1 de manière inconditionnelle puis on enregistre ça :
page_no += 1 draft_id = session.get_by_magictoken(magictoken, {}).get('draft_formdata_id') if draft_id: # if there's a draft (be it because drafts are enabled or # because the formdata was created as a draft via the # submission API), update it with current data. try: self.autosave_draft(draft_id, page_no, form_data)
quand on abandonne alors le brouillon à cet endroit, plouf.
(je vais maintenant tenter la rédaction d'un test pour vérifier)
Mis à jour par Frédéric Péters il y a presque 6 ans
- Fichier 0001-forms-use-proper-pages-calculation-to-know-if-page-n.patch 0001-forms-use-proper-pages-calculation-to-know-if-page-n.patch ajouté
- Statut changé de En cours à Solution proposée
- Patch proposed changé de Non à Oui
Yep, patch qui valide l'idée.
Mis à jour par Frédéric Péters il y a presque 6 ans
- Statut changé de Solution proposée à Résolu (à déployer)
commit e5cfcfbc4f0eab6de9e833a081976bc5c315673c Author: Frédéric Péters <fpeters@entrouvert.com> Date: Fri Jul 13 10:24:06 2018 +0200 forms: use proper pages calculation to know if page number is out (#25263)
Mis à jour par Frédéric Péters il y a plus de 5 ans
- Statut changé de Résolu (à déployer) à Solution déployée
forms: use proper pages calculation to know if page number is out (#25263)