summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_common.py
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-07-11 17:32:58 -0400
committerHolger Levsen <holger@layer-acht.org>2016-07-24 11:46:02 -0400
commit1f6e833815c011e56ab77a258b4eee94a8acaf43 (patch)
tree8df6e0678eb99b6110ff9506e2f7c0115cd5f2cc /bin/reproducible_common.py
parent0b4d9e94923280e5e836105a8b82e9b01f1714d0 (diff)
downloadjenkins.debian.net-1f6e833815c011e56ab77a258b4eee94a8acaf43.tar.xz
reproducible debian: move html from code into basic_page template
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_common.py')
-rwxr-xr-xbin/reproducible_common.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index 95b652e3..70a4f62c 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -155,6 +155,8 @@ project_links_template = renderer.load_template(
os.path.join(TEMPLATE_PATH, 'project_links'))
main_navigation_template = renderer.load_template(
os.path.join(TEMPLATE_PATH, 'main_navigation'))
+basic_page_template = renderer.load_template(
+ os.path.join(TEMPLATE_PATH, 'basic_page'))
html_header = Template("""<!DOCTYPE html>
<html>
@@ -278,32 +280,28 @@ def create_main_navigation(page_title, suite, arch, displayed_page=None):
def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch,
noheader=False, style_note=False, noendpage=False,
packages=False, refresh_every=None, displayed_page=None):
- now = datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC')
- html = ''
meta_refresh = '<meta http-equiv="refresh" content="%d">' % \
refresh_every if refresh_every is not None else ''
- html += html_header.substitute(
- page_title=title,
- meta_refresh=meta_refresh)
+ context = {
+ 'page_title': title,
+ 'meta_refresh': meta_refresh,
+ }
if not noheader:
- html += create_main_navigation(
+ context['main_navigation_html'] = create_main_navigation(
page_title=title,
suite=suite,
arch=arch,
displayed_page=displayed_page,
)
- # Add the 'mainbody' div only if including a header
- html += "<div class='mainbody'>"
- html += body
+ main_html = body
if style_note:
- html += renderer.render(pkg_legend_template, {})
+ main_html += renderer.render(pkg_legend_template, {})
if not noendpage:
- html += create_default_page_footer(now)
- if not noheader:
- # If the header was included, we need to end the 'mainbody' div after
- # the 'mainbody' content
- html += '</div>'
- html += '</body>\n</html>'
+ now = datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC')
+ main_html += create_default_page_footer(now)
+ context['main_html'] = main_html
+ html = renderer.render(basic_page_template, context)
+
try:
os.makedirs(destfile.rsplit('/', 1)[0], exist_ok=True)
except OSError as e: