summaryrefslogtreecommitdiff
path: root/lorrycontroller/status.py
diff options
context:
space:
mode:
Diffstat (limited to 'lorrycontroller/status.py')
-rw-r--r--lorrycontroller/status.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/lorrycontroller/status.py b/lorrycontroller/status.py
index 40bf964..9c907bf 100644
--- a/lorrycontroller/status.py
+++ b/lorrycontroller/status.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2014 Codethink Limited
+# Copyright (C) 2014-2017 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -39,6 +39,7 @@ class StatusRenderer(object):
'warning_msg': '',
'max_jobs': self.get_max_jobs(statedb),
'links': True,
+ 'publish_failures': True,
}
status.update(self.get_free_disk_space(work_directory))
return status
@@ -46,9 +47,11 @@ class StatusRenderer(object):
def render_status_as_html(self, template, status):
return bottle.template(template, **status)
- def write_status_as_html(self, template, status, filename):
+ def write_status_as_html(self, template, status, filename,
+ publish_failures):
modified_status = dict(status)
modified_status['links'] = False
+ modified_status['publish_failures'] = publish_failures
html = self.render_status_as_html(template, modified_status)
# We write the file first to a temporary file and then
@@ -58,7 +61,7 @@ class StatusRenderer(object):
try:
temp_filename = self.temp_filename_in_same_dir_as(filename)
with open(temp_filename, 'w') as f:
- f.write(html)
+ f.write(html.encode("UTF-8"))
os.rename(temp_filename, filename)
except (OSError, IOError) as e:
self.remove_temp_file(temp_filename)
@@ -167,7 +170,8 @@ class Status(lorrycontroller.LorryControllerRoute):
renderer.write_status_as_html(
self._templates['status'],
status,
- self.app_settings['status-html'])
+ self.app_settings['status-html'],
+ self.app_settings['publish-failures'])
return status
@@ -185,6 +189,7 @@ class StatusHTML(lorrycontroller.LorryControllerRoute):
renderer.write_status_as_html(
self._templates['status'],
status,
- self.app_settings['status-html'])
+ self.app_settings['status-html'],
+ self.app_settings['publish-failures'])
return renderer.render_status_as_html(
self._templates['status'], status)