~chromakode/boots/generic-use

« back to all changes in this revision

Viewing changes to boots/lib/ui/plain.py

  • Committer: Max Goodman
  • Date: 2010-03-23 08:43:44 UTC
  • Revision ID: chromakode@gmail.com-20100323084344-z4fjac5xwbzflbb3
In table output from the plain presenter, leave enough space for a NULL value in columns that could contain them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
182
182
 
183
183
        def _gen_table(info):
184
184
            if self.buffer:
185
 
                max_widths = map(max, [(len(column.name), column.display_size) for column in info["description"]])
 
185
                print list(info["description"])
 
186
                # If a column can contain the value NULL, we leave at least 4
 
187
                # characters, since display_size does not account for NULL.
 
188
                max_widths = map(max, [(len(column.name),
 
189
                                        column.display_size,
 
190
                                        4 if column.null_ok else 0)
 
191
                                 for column in info["description"]])
186
192
                dashes = map(lambda x: "-"*(x+2), max_widths)
187
193
                sep_line = "+" + "+".join(dashes) + "+"
188
194
                names = (column[0] for column in info["description"])