Projet

Général

Profil

0001-fields-ignore-errors-for-shorter-than-expected-rows-.patch

Frédéric Péters, 22 juillet 2015 16:15

Télécharger (1,27 ko)

Voir les différences:

Subject: [PATCH] fields: ignore errors for shorter than expected rows in
 TableRowsField (#7905)

This is typical of the field gaining new columns after some forms were already
saved.
 wcs/fields.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
wcs/fields.py
1484 1484

  
1485 1485
        for i, row_value in enumerate(value):
1486 1486
            for j, column in enumerate(self.columns):
1487
                max_width = max(max_width, len(row_value[j]))
1487
                try:
1488
                    max_width = max(max_width, len(row_value[j]))
1489
                except IndexError:
1490
                    # ignore errors for shorter than expected rows, this is
1491
                    # typical of the field gaining new columns after some forms
1492
                    # were already saved.
1493
                    pass
1488 1494

  
1489 1495
        r.append(' '.join(['='*max_width]*(len(self.columns))))
1490 1496
        r.append(' '.join([column.center(max_width) for column in self.columns]))
1491
-