diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-01-10 02:34:42 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-01-11 00:39:20 +0000 |
commit | c16305b50186dae520a2cf08912d9446cc917763 (patch) | |
tree | 9dfccae249e0cd949a583a4b042c1997e96f58cb | |
parent | 93684e978f14ad072c43a9f22c594320d5043417 (diff) | |
download | jenkins.debian.net-c16305b50186dae520a2cf08912d9446cc917763.tar.xz |
reproducible: common.py: make possible to do not write the very last footer in write_html_page()
-rwxr-xr-x | bin/reproducible_common.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index 868466a5..d2ab8047 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -171,7 +171,7 @@ html_foot_page = Template((tab*2).join(""" url2html = re.compile(r'((mailto\:|((ht|f)tps?)\://|file\:///){1}\S+)') -def write_html_page(title, body, destfile, noheader=False, nofooter=False): +def write_html_page(title, body, destfile, noheader=False, nofooter=False, noendpage=False): now = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC') html = '' html += html_header.substitute(page_title=title) @@ -186,7 +186,10 @@ def write_html_page(title, body, destfile, noheader=False, nofooter=False): html += body if not nofooter: html += html_foot_page.substitute() - html += html_footer.substitute(date=now) + if not noendpage: + html += html_footer.substitute(date=now) + else: + html += '</body>\n</html>' os.makedirs(destfile.rsplit('/', 1)[0], exist_ok=True) with open(destfile, 'w') as fd: fd.write(html) |