comparison frontends/src/jp/common.py @ 2344:78ffb9ce57a4

jp (common): fixed empty table display when headers are specified
author Goffi <goffi@goffi.org>
date Wed, 23 Aug 2017 00:08:30 +0200
parents ca14e1ced3b5
children c57bc0fe17d9
comparison
equal deleted inserted replaced
2343:ca1ab42c7ae9 2344:78ffb9ce57a4
553 else: 553 else:
554 if len(new_row) != size: 554 if len(new_row) != size:
555 raise exceptions.DataError(u'rows size is not coherent') 555 raise exceptions.DataError(u'rows size is not coherent')
556 self.rows.append(new_row) 556 self.rows.append(new_row)
557 557
558 if not data and headers is not None:
559 # the table is empty, we print headers at their lenght
560 self.sizes = [len(h) for h in headers]
561
558 @staticmethod 562 @staticmethod
559 def readDictValues(data, keys, defaults=None): 563 def readDictValues(data, keys, defaults=None):
560 if defaults is None: 564 if defaults is None:
561 defaults = {} 565 defaults = {}
562 for key in keys: 566 for key in keys: