Skip to content

Commit de6c3f8

Browse files
author
Thomas Preud'homme
committed
[LNT] Python 3 support: store color value as int
Summary: Page v4_graph.html sets the background color of some table entries from float color values set in the v4_graph() method of lnt.server.ui.views module using the %x specifier. However Python 3 gives an error in such a case because it only accepts integer values. Under Python 2 an implicit cast to int was performed. This commit adds an explicit cast to int when storing the color value to satisfy the Python 3 requirement for %x format specifier. Reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls, leandron, PrzemekWirkus Reviewed By: cmatthews Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D68987
1 parent 593510c commit de6c3f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lnt/server/ui/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,8 @@ def v4_graph():
928928
# Determine the base plot color.
929929
col = list(util.makeDarkColor(float(i) / num_plots))
930930
url = "/".join([str(machine.id), str(test.id), str(field_index)])
931-
legend.append(LegendItem(machine, test.name, field.name, tuple(col),
932-
url))
931+
legend.append(LegendItem(machine, test.name, field.name,
932+
tuple(map(int, col)), url))
933933

934934
# Load all the field values for this test on the same machine.
935935
#
@@ -983,7 +983,7 @@ def v4_graph():
983983
# Make a color closer to the sample than its neighbour.
984984
color_offset = float(baseline_id) / num_baselines / 2
985985
my_color = (i + color_offset) / num_plots
986-
dark_col = list(util.makeDarkerColor(my_color))
986+
dark_col = list(map(int, util.makeDarkerColor(my_color)))
987987
str_dark_col = util.toColorString(dark_col)
988988
baseline_plots.append({
989989
'color': str_dark_col,

0 commit comments

Comments
 (0)