Projet

Général

Profil

Bug #17061

crash sur l'affichage d'un champ tableau (list index out of range)

Ajouté par Thomas Noël il y a presque 7 ans. Mis à jour il y a 3 mois.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
21 juin 2017
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Non
Planning:
Non

Description

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/fields.py", line 1781, in get_rst_view_value
  1779         for i, row_value in enumerate(value):
  1780             r.append(' '.join([cell.center(max_width) for cell in
> 1781                     [row_value[x] for x in range(len(self.columns))]]))
  1782         r.append(' '.join(['='*max_width]*(len(self.columns))))
  1783         return '\n'.join([indent + x for x in r])

  locals:
     indent = '  '
     i = 0
     self = <wcs.fields.TableRowsField object at 0x7fb1dbab4650>
     j = 4
     max_width = 21
     column = 'Adresse \xc3\xa9lectronique'
     row_value = ['nom prenom', '10 rue', '0546', 'email@example.net']
     value = [['nom prenom', '10 rue', '0546', 'email@example.net'], ['2', '2', '2', '2']]
     x = 4
     r = ['===================== ===================== ===================== ===================== =====================', '
Nom                 Pr\xc3\xa9nom               Adresse             T\xc3\xa9l\xc3\xa9phone      Adresse \xc3\xa9lectronique',
'===================== ===================== ===================== ===================== =====================']
     row = ['2', '2', '2', '2']

  File "/usr/lib/python2.7/dist-packages/wcs/formdef.py", line 1074, in get_detailed_email_form
  1072                 details.append(('  %s' % value).replace('\n', '\n  '))
  1073             else:
> 1074                 details.append('%s' % field.get_rst_view_value(value, indent='  '))
  1075             details.append('')
  1076         return '\n'.join(details)

Révisions associées

Révision c30dbe48 (diff)
Ajouté par Frédéric Péters il y a 3 mois

widgets: make table widget handle loading back incomplete data (#17061)

Historique

#2

Mis à jour par Thomas Noël il y a presque 7 ans

Forte probabilité que le champ ait évolué après les données (colonne "nom prenom" devenue deux colonnes "nom" "prenom")

#3

Mis à jour par Frédéric Péters il y a plus de 2 ans

  • Planning mis à Non

Pas dans la même méthode mais la même origine,

  type = '<class 'IndexError'>', value = 'list index out of range'

Stack trace (most recent call first):
  File "/usr/lib/python3/dist-packages/wcs/qommon/form.py", line 1920, in __init__
  1918                 widget = self.get_widget('c-%s-%s' % (i, j))
  1919                 if value and self.readonly:
> 1920                     widget.set_value(value[i][j])
  1921                     widget.transfer_form_value(get_request())
  1922

  locals:
     columns = ['Missions', 'Nombre', 'Quotité  (temps complet ou partiel)', 'Nombre d’heures annuelles']
     i = 4
     j = 0
     kwargs = {'readonly': 'readonly', 'render_br': False, 'id': 'f633', 'form': <wcs.qommon.form.Form object at 0x7efc0531c0f0>}
     name = 'f633'
     rows = ['CDI', 'CDD', 'Auto-entrepreneur', 'Contrats aidés', 'Apprentis']
     self = <TableWidget at 7efc053bf198: f633>
     value = [[None, None, None, None], [None, None, None, None], [None, None, None, None], [None, None, None, None]]
     widget = <StringWidget at 7efc052fbf98: f633$c-4-0>

  File "/usr/lib/python3/dist-packages/quixote/form/form.py", line 235, in add
   233             kwargs['id'] = name
   234         kwargs['form'] = self
>  235         widget = widget_class(name, *args, **kwargs)
   236         self._names[name] = widget
   237         if isinstance(widget, SubmitWidget):

  locals:
     args = ()
     kwargs = {'title': 'Nombre de salariés', 'value': [[None, None, None, None], [None, None, None, None], [None, None, None, None], [None, None, None, None]], 'readonly': 'readonly', 'render_br': False, 'rows': ['CDI', 'CDD', 'Auto-entrepreneur', 'Contrats aidés', 'Apprentis'], 'columns': ['Missions', 'Nombre',
'Quotité  (temps complet ou partiel)', 'Nombre d’heures annuelles'], 'id': 'f633', 'form': <wcs.qommon.form.Form object at 0x7efc0531c0f0>}
     name = 'f633'
     self = <wcs.qommon.form.Form object at 0x7efc0531c0f0>
     widget_class = <class 'wcs.qommon.form.TableWidget'>

avec le tableau qui a gagné une ligne mais la restauration d'un brouillon qui amène un tableau qui n'a pas cette ligne supplémentaire.

#5

Mis à jour par Robot Gitea il y a 4 mois

  • Statut changé de Nouveau à En cours
  • Assigné à mis à Frédéric Péters

Frédéric Péters (fpeters) a ouvert une pull request sur Gitea concernant cette demande :

#6

Mis à jour par Robot Gitea il y a 4 mois

  • Statut changé de En cours à Solution proposée
#7

Mis à jour par Robot Gitea il y a 4 mois

  • Statut changé de Solution proposée à Solution validée

Thomas NOËL (tnoel) a approuvé une pull request sur Gitea concernant cette demande :

#8

Mis à jour par Robot Gitea il y a 3 mois

  • Statut changé de Solution validée à Résolu (à déployer)

Frédéric Péters (fpeters) a mergé une pull request sur Gitea concernant cette demande :

#9

Mis à jour par Transition automatique il y a 3 mois

  • Statut changé de Résolu (à déployer) à Solution déployée
#10

Mis à jour par Transition automatique il y a environ un mois

Automatic expiration

Formats disponibles : Atom PDF