diff --git a/src/allmydata/util/_python3.py b/src/allmydata/util/_python3.py index 623a70a6c..c9e42f916 100644 --- a/src/allmydata/util/_python3.py +++ b/src/allmydata/util/_python3.py @@ -119,6 +119,7 @@ PORTED_MODULES = [ "allmydata.web.common", "allmydata.web.directory", "allmydata.web.logs", + "allmydata.web.operations", "allmydata.webish", ] diff --git a/src/allmydata/web/operations.py b/src/allmydata/web/operations.py index 29533523b..aedf33f37 100644 --- a/src/allmydata/web/operations.py +++ b/src/allmydata/web/operations.py @@ -1,4 +1,14 @@ -from past.builtins import unicode +""" +Ported to Python 3. +""" +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from future.utils import PY2 +if PY2: + from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 import time from hyperlink import ( @@ -91,7 +101,7 @@ class OphandleTable(resource.Resource, service.Service): """ ophandle = get_arg(req, "ophandle").decode("utf-8") assert ophandle - here = DecodedURL.from_text(unicode(URLPath.fromRequest(req))) + here = DecodedURL.from_text(str(URLPath.fromRequest(req))) target = here.click(u"/").child(u"operations", ophandle) output = get_arg(req, "output") if output: @@ -102,7 +112,7 @@ class OphandleTable(resource.Resource, service.Service): def getChild(self, name, req): ophandle = name if ophandle not in self.handles: - raise WebError("unknown/expired handle '%s'" % escape(unicode(ophandle, "utf-8")), + raise WebError("unknown/expired handle '%s'" % escape(str(ophandle, "utf-8")), NOT_FOUND) (monitor, renderer, when_added) = self.handles[ophandle]