class SuiteManagerDoc(BaseDocument): def __init__(self, app, **atts): BaseDocument.__init__(self, app, **atts) self.cursor = SuiteCursor(self.conn) def set_suite(self, suite): self.suite = suite self.cursor.set_suite(suite) self.clear_body() attributes = dict(bgcolor='IndianRed', width='100%') title = SimpleTitleElement('Suite: %s' % suite, **attributes) title.cell.attributes['align'] = 'center' self.body.append(title) apt_rows = self.cursor.get_apt_rows() if len(apt_rows): aptsrc_table = Table(bgcolor='khaki') self.body.append(aptsrc_table) fields = ['apt_id', 'uri', 'dist', 'sections', 'local_path'] headrow = TableRow() for field in fields: headrow.append(TableCell(Bold(field))) for row in apt_rows: tblrow = TableRow() aptsrc_table.append(tblrow) for field in fields: tblrow.append(TableCell(row[field]))