Port to Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-03-02 09:31:35 -05:00
parent 0be3349c5d
commit 7b1911620f
4 changed files with 25 additions and 6 deletions

@ -236,11 +236,11 @@ class StorageFarmBroker(service.MultiService):
for plugin
in getPlugins(IFoolscapStoragePlugin)
}
return {
return UnicodeKeyDict({
name: plugins[name].get_client_resource(node_config)
for (name, config)
in self.storage_client_config.storage_plugins.items()
}
})
@log_call(
action_type=u"storage-client:broker:make-storage-server",

@ -128,6 +128,8 @@ PORTED_MODULES = [
"allmydata.web.private",
"allmydata.web.root",
"allmydata.web.status",
"allmydata.web.storage",
"allmydata.web.storage_plugins",
"allmydata.webish",
]

@ -1,4 +1,14 @@
"""
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 twisted.python.filepath import FilePath
@ -318,7 +328,4 @@ class StorageStatus(MultiFormatResource):
"lease-checker": self._storage.lease_checker.get_state(),
"lease-checker-progress": self._storage.lease_checker.get_progress(),
}
result = json.dumps(d, indent=1) + "\n"
if PY2:
result = result.decode("utf-8")
return result.encode("utf-8")
return json.dumps(d, indent=1) + "\n"

@ -1,7 +1,17 @@
"""
This module implements a resource which has as children the web resources
of all enabled storage client plugins.
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
from twisted.web.resource import (
Resource,