More passing tests on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2020-10-16 10:55:33 -04:00
parent bcd7cdf86f
commit f689d59a40
2 changed files with 10 additions and 7 deletions

View File

@ -642,7 +642,7 @@ def anonymous_storage_enabled(config):
"""
return (
storage_enabled(config) and
config.get_config(b"storage", b"anonymous", True, boolean=True)
config.get_config("storage", "anonymous", True, boolean=True)
)
@ -781,7 +781,7 @@ class _Client(node.Node, pollmixin.PollMixin):
vk_string = ed25519.string_from_verifying_key(self._node_public_key)
vk_bytes = remove_prefix(vk_string, ed25519.PUBLIC_KEY_PREFIX)
seed = base32.b2a(vk_bytes)
self.config.write_config_file("permutation-seed", seed+"\n")
self.config.write_config_file("permutation-seed", seed+b"\n", mode="wb")
return seed.strip()
def get_anonymous_storage_server(self):
@ -806,7 +806,7 @@ class _Client(node.Node, pollmixin.PollMixin):
config_storedir = self.get_config(
"storage", "storage_dir", self.STOREDIR,
).decode('utf-8')
)
storedir = self.config.get_config_path(config_storedir)
data = self.config.get_config("storage", "reserved_space", None)

View File

@ -549,9 +549,12 @@ def _convert_tub_port(s):
:returns: a proper Twisted endpoint string like (`tcp:X`) is `s`
is a bare number, or returns `s` as-is
"""
if re.search(r'^\d+$', s):
return "tcp:{}".format(int(s))
return s
us = s
if isinstance(s, bytes):
us = s.decode("utf-8")
if re.search(r'^\d+$', us):
return "tcp:{}".format(int(us))
return us
def _tub_portlocation(config):
@ -844,7 +847,7 @@ class Node(service.MultiService):
self.config.get_config_path("log_gatherer.furl"))
incident_dir = self.config.get_config_path("logs", "incidents")
foolscap.logging.log.setLogDir(incident_dir.encode(get_filesystem_encoding()))
foolscap.logging.log.setLogDir(incident_dir)
twlog.msg("Foolscap logging initialized")
twlog.msg("Note to developers: twistd.log does not receive very much.")
twlog.msg("Use 'flogtool tail -c NODEDIR/private/logport.furl' instead")