Exemple #1
0
	def test_html_export(self):

		"""HTML export"""

		html = markup.page()
		html.table.open()
		html.thead.open()

		html.tr(markup.oneliner.th(self.founders.headers))
		html.thead.close()

		for founder in self.founders:

			html.tr(markup.oneliner.td(founder))

		html.table.close()
		html = str(html)

		self.assertEqual(html, self.founders.html)
Exemple #2
0
def export_set(dataset):
    """HTML representation of a Dataset."""

    stream = StringIO()

    page = markup.page()
    page.table.open()

    if dataset.headers is not None:
        page.thead.open()
        headers = markup.oneliner.th(dataset.headers)
        page.tr(headers)
        page.thead.close()

    for row in dataset:
        html_row = markup.oneliner.td(row)
        page.tr(html_row)

    page.table.close()

    stream.writelines(str(page))

    return stream.getvalue()