Table constructor. Keyword arguments: rows -- iterable of SimpleTableRow header_row -- row that will be displayed at the beginning of the table. if this row is SimpleTableRow, it is the programmer's responsibility to verify whether
(self, rows=None, header_row=None, css_class=None)
| 202 | """ |
| 203 | |
| 204 | def __init__(self, rows=None, header_row=None, css_class=None): |
| 205 | """Table constructor. |
| 206 | |
| 207 | Keyword arguments: |
| 208 | rows -- iterable of SimpleTableRow |
| 209 | header_row -- row that will be displayed at the beginning of the table. |
| 210 | if this row is SimpleTableRow, it is the programmer's |
| 211 | responsibility to verify whether it was created with the |
| 212 | header flag set to True. |
| 213 | css_class -- table CSS class |
| 214 | """ |
| 215 | rows = rows or [] |
| 216 | if isinstance(rows[0], SimpleTableRow): |
| 217 | self.rows = rows |
| 218 | else: |
| 219 | self.rows = [SimpleTableRow(row) for row in rows] |
| 220 | |
| 221 | if header_row is None: |
| 222 | self.header_row = None |
| 223 | elif isinstance(header_row, SimpleTableRow): |
| 224 | self.header_row = header_row |
| 225 | else: |
| 226 | self.header_row = SimpleTableRow(header_row, header=True) |
| 227 | |
| 228 | self.css_class = css_class |
| 229 | |
| 230 | def __str__(self): |
| 231 | """Return the HTML code for the table as a string.""" |
nothing calls this directly
no test coverage detected