mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-19 08:16:19 +00:00
More progress towards passing Python 3 tests.
This commit is contained in:
parent
06c4ed13b7
commit
069fcb91eb
@ -5,12 +5,12 @@ from past.builtins import unicode
|
||||
import os.path
|
||||
import time
|
||||
from urllib.parse import quote as url_quote
|
||||
import json
|
||||
import datetime
|
||||
|
||||
from allmydata.scripts.common import get_alias, escape_path, DEFAULT_ALIAS, \
|
||||
UnknownAliasError
|
||||
from allmydata.scripts.common_http import do_http, HTTPError, format_http_error
|
||||
from allmydata.util import time_format
|
||||
from allmydata.util import time_format, jsonbytes as json
|
||||
from allmydata.scripts import backupdb
|
||||
from allmydata.util.encodingutil import listdir_unicode, quote_output, \
|
||||
quote_local_unicode_path, to_bytes, FilenameEncodingError, unicode_to_url
|
||||
@ -167,7 +167,7 @@ class BackerUpper(object):
|
||||
if must_create:
|
||||
self.verboseprint(" creating directory for %s" % quote_local_unicode_path(path))
|
||||
newdircap = mkdir(create_contents, self.options)
|
||||
assert isinstance(newdircap, str)
|
||||
assert isinstance(newdircap, bytes)
|
||||
if r:
|
||||
r.did_create(newdircap)
|
||||
return True, newdircap
|
||||
|
@ -1,6 +1,10 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import urllib, time
|
||||
from past.builtins import unicode
|
||||
from six import ensure_text
|
||||
|
||||
import time
|
||||
from urllib.parse import quote as url_quote
|
||||
import json
|
||||
from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path, \
|
||||
UnknownAliasError
|
||||
@ -23,7 +27,7 @@ def list(options):
|
||||
except UnknownAliasError as e:
|
||||
e.display(stderr)
|
||||
return 1
|
||||
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
|
||||
url = nodeurl + "uri/%s" % url_quote(rootcap)
|
||||
if path:
|
||||
# move where.endswith check here?
|
||||
url += "/" + escape_path(path)
|
||||
@ -164,7 +168,7 @@ def list(options):
|
||||
while len(left_justifys) <= i:
|
||||
left_justifys.append(False)
|
||||
max_widths[i] = max(max_widths[i], len(cell))
|
||||
if cell.startswith("URI"):
|
||||
if ensure_text(cell).startswith("URI"):
|
||||
left_justifys[i] = True
|
||||
if len(left_justifys) == 1:
|
||||
left_justifys[0] = True
|
||||
|
@ -153,7 +153,7 @@ class Backup(GridTestMixin, CLITestMixin, StallMixin, unittest.TestCase):
|
||||
lines = out.split("\n")
|
||||
children = dict([line.split() for line in lines if line])
|
||||
latest_uri = children["Latest"]
|
||||
self.failUnless(latest_uri.startswith("URI:DIR2-CHK:"), latest_uri)
|
||||
self.failUnless(latest_uri.startswith(b"URI:DIR2-CHK:"), latest_uri)
|
||||
childnames = children.keys()
|
||||
self.failUnlessReallyEqual(sorted(childnames), ["Archives", "Latest"])
|
||||
d.addCallback(_check1)
|
||||
@ -387,7 +387,7 @@ class Backup(GridTestMixin, CLITestMixin, StallMixin, unittest.TestCase):
|
||||
self._check_filtering(filtered, root_listdir, (u'_darcs', u'subdir'),
|
||||
(nice_doc, u'lib.a'))
|
||||
# read exclude patterns from file
|
||||
exclusion_string = doc_pattern_arg + "\nlib.?"
|
||||
exclusion_string = doc_pattern_arg + b"\nlib.?"
|
||||
excl_filepath = os.path.join(basedir, 'exclusion')
|
||||
fileutil.write(excl_filepath, exclusion_string)
|
||||
backup_options = parse(['--exclude-from', excl_filepath, 'from', 'to'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user