def write_reports_about(self, a_list, a_folder): if not self._reporter.events: return HTMLObjects.HTMLNone() self._write_index_file(a_list, a_folder) for person in sorted(a_list, key=lambda p: person_code(p)): html = self._reporter.report_about(person) filename = a_folder + '\\' + person_code(person) + '.html' fileopen = open(filename, 'w') fileopen.write(html.html_string()) fileopen.close()
def _write_index_file(self, a_list, a_folder): table = HTMLObjects.HTMLTable() for person in a_list: text = HTMLObjects.HTMLLink(person_code(person), "./" + person_code(person) + ".html") cell = HTMLObjects.HTMLTableCell(text) row = HTMLObjects.HTMLTableRow(cell) table.add(row) html = HTMLObjects.HTMLAll(HTMLObjects.HTMLHead(HTMLObjects.HTMLPageTitle('People'))) html.add(HTMLObjects.HTMLLink("index", "../index.html")) html.add(HTMLObjects.HTMLTitle('People')) html.add(table) filename = a_folder + '\\' + 'index.html' fileopen = open(filename, 'w') fileopen.write(html.html_string()) fileopen.close()
def _html_table_row(self, appointment): html = HTMLObjects.HTMLTableRow() if appointment.disabled and not (appointment.is_filled()): return None link = HTMLObjects.HTMLLink(appointment.role.description, "../roles/" + appointment.role.description + ".html") html.add(HTMLObjects.HTMLTableCell(link)) if appointment.is_filled(): link = HTMLObjects.HTMLLink(person_code(appointment.person), "../people/" + person_code(appointment.person) + ".html") html.add(HTMLObjects.HTMLTableCell(link)) else: html.add(HTMLObjects.HTMLTableCell('Not filled', 3, 1)) html.add(HTMLObjects.HTMLTableCell(appointment.note)) return html
def person_name(an_object): if an_object.is_filled(): link = HTMLObjects.HTMLLink(person_code(an_object.person), "../people/" + person_code(an_object.person) + ".html") return link.html_string() else: return 'Not filled'
def _html_header(self): return HTMLObjects.HTMLTitle(person_code(self._person))