diff --git a/src/allmydata/test/test_checker.py b/src/allmydata/test/test_checker.py index 0a10ea5d4..0d5877abe 100644 --- a/src/allmydata/test/test_checker.py +++ b/src/allmydata/test/test_checker.py @@ -201,8 +201,8 @@ class WebResultsRendering(unittest.TestCase): def test_check(self): c = self.create_fake_client() sb = c.storage_broker - serverid_1 = "\x00"*20 - serverid_f = "\xff"*20 + serverid_1 = b"\x00"*20 + serverid_f = b"\xff"*20 server_1 = sb.get_stub_server(serverid_1) server_f = sb.get_stub_server(serverid_f) u = uri.CHKFileURI(b"\x00"*16, b"\x00"*32, 3, 10, 1234) @@ -269,7 +269,7 @@ class WebResultsRendering(unittest.TestCase): self.failUnlessIn("Not Recoverable! : rather dead", s) html = self.render_element(w, args={"return_to": ["FOOURL"]}) - self.failUnlessIn('Return to file/directory.', + self.failUnlessIn(b'Return to file/directory.', html) w = web_check_results.CheckResultsRenderer(c, cr) @@ -430,19 +430,19 @@ class WebResultsRendering(unittest.TestCase): def test_deep_check_renderer(self): status = check_results.DeepCheckResults(b"fake-root-si") status.add_check( - FakeCheckResults("", False, False), + FakeCheckResults(b"", False, False), (u"fake", u"unhealthy", u"unrecoverable") ) status.add_check( - FakeCheckResults("", True, True), + FakeCheckResults(b"", True, True), (u"fake", u"healthy", u"recoverable") ) status.add_check( - FakeCheckResults("", True, False), + FakeCheckResults(b"", True, False), (u"fake", u"healthy", u"unrecoverable") ) status.add_check( - FakeCheckResults("", False, True), + FakeCheckResults(b"", False, True), (u"fake", u"unhealthy", u"recoverable") ) @@ -524,15 +524,15 @@ class WebResultsRendering(unittest.TestCase): status = check_results.DeepCheckAndRepairResults(b"") status.add_check_and_repair( - FakeCheckAndRepairResults("attempted/success", True, True), + FakeCheckAndRepairResults(b"attempted/success", True, True), (u"attempted", u"success") ) status.add_check_and_repair( - FakeCheckAndRepairResults("attempted/failure", True, False), + FakeCheckAndRepairResults(b"attempted/failure", True, False), (u"attempted", u"failure") ) status.add_check_and_repair( - FakeCheckAndRepairResults("unattempted/failure", False, False), + FakeCheckAndRepairResults(b"unattempted/failure", False, False), (u"unattempted", u"failure") ) diff --git a/src/allmydata/web/check_results.py b/src/allmydata/web/check_results.py index fd8891d3c..de2762df1 100644 --- a/src/allmydata/web/check_results.py +++ b/src/allmydata/web/check_results.py @@ -1,3 +1,4 @@ +from future.builtins import str import time import json @@ -200,7 +201,7 @@ class ResultsBase(object): return tags.ul(r) def _html(self, s): - if isinstance(s, (str, unicode)): + if isinstance(s, (bytes, str)): return html.escape(s) assert isinstance(s, (list, tuple)) return [html.escape(w) for w in s] @@ -522,7 +523,7 @@ class DeepCheckResultsRendererElement(Element, ResultsBase, ReloadMixin): summary = cr.get_summary() if summary: summary_text = ": " + summary - summary_text += " [SI: %s]" % cr.get_storage_index_string() + summary_text += " [SI: %s]" % cr.get_storage_index_string().decode("ascii") problems.append({ # Not sure self._join_pathstring(path) is the # right thing to use here.