summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_common.py
diff options
context:
space:
mode:
authorValerie R Young <spectranaut@riseup.net>2016-06-30 14:42:11 -0400
committerHolger Levsen <holger@layer-acht.org>2016-07-17 12:12:05 +0200
commitb3999887aa7387e7db24ebab04d3d15c4ac7d9df (patch)
tree442b4759576bd5e9c9f2753c181c539a36f34b54 /bin/reproducible_common.py
parentf16c248f5153732d36e808df1da2e12c8fd8a6bf (diff)
downloadjenkins.debian.net-b3999887aa7387e7db24ebab04d3d15c4ac7d9df.tar.xz
reproducible debian: add main navigation highlighting to python pages
Added the correct navigation highlighting to the following pages: notes, no notes, tested in the last 24 hours, tested in the last 48 hours, all packages, notifications enabled, breakages, issue pages, scheduled, and maintainers page. Signed-off-by: Mattia Rizzolo <mattia@debian.org> Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_common.py')
-rwxr-xr-xbin/reproducible_common.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index ed095e07..28b4add4 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -254,7 +254,7 @@ def convert_into_hms_string(duration):
# See bash equivelent: reproducible_common.sh's "write_page_header()"
-def create_main_navigation(page_title, suite, arch):
+def create_main_navigation(page_title, suite, arch, displayed_page=None):
context = {
'page_title': page_title,
'suite': suite,
@@ -265,10 +265,16 @@ def create_main_navigation(page_title, suite, arch):
'arch_list': [{'a': a} for a in ARCHS],
'debian_url': DEBIAN_URL,
}
+ # this argument controls which of the main page navigation items will be
+ # highlighted.
+ if displayed_page:
+ context[displayed_page] = True
return renderer.render(main_navigation_template, context)
-def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, noheader=False, style_note=False, noendpage=False, packages=False, refresh_every=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">' % \
@@ -277,7 +283,12 @@ def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch,
page_title=title,
meta_refresh=meta_refresh)
if not noheader:
- html += create_main_navigation(title, suite, arch)
+ html += create_main_navigation(
+ page_title=title,
+ suite=suite,
+ arch=arch,
+ displayed_page=displayed_page,
+ )
html += body
if style_note:
@@ -292,6 +303,7 @@ def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch,
except OSError as e:
if e.errno != errno.EEXIST: # that's 'File exists' error (errno 17)
raise
+ log.debug("Writing " + destfile)
with open(destfile, 'w', encoding='UTF-8') as fd:
fd.write(html)