elif self._db.is_new_file(pathinfo, relpath_u):
new_version = current_version + 1
else:
- self._log("Not uploading '{0}'".format(relpath_u))
+ self._log("Not uploading %r" % (relpath_u,))
self._count('objects_not_uploaded')
return
elif self._db.is_new_file(pathinfo, relpath_u):
new_version = current_version + 1
else:
- self._log("Not uploading '{0}'".format(relpath_u))
+ self._log("Not uploading %r" % (relpath_u,))
self._count('objects_not_uploaded')
return None
if self._should_download(relpath_u, metadata['version']):
extension += [(relpath_u, file_node, metadata)]
else:
- self._log("Excluding '{0}'".format(relpath_u))
+ self._log("Excluding %r" % (relpath_u,))
self._count('objects_excluded')
self._call_hook(None, 'processed')
return extension
mkdir(data_base)
if not exists(tahoe_bin):
- raise RuntimeError("Can't find 'tahoe' binary at '{}'".format(tahoe_bin))
+ raise RuntimeError("Can't find 'tahoe' binary at %r" % (tahoe_bin,))
if 'kill' in sys.argv:
print("Killing the grid")
subprocess.check_call(
[
tahoe_bin, 'create-node',
- '--nickname', 'node{}'.format(x),
+ '--nickname', 'node%d' % (x,),
'--introducer', furl,
data_dir,
]
with open(join(data_dir, 'tahoe.cfg'), 'w') as f:
f.write('''
[node]
-nickname = node{node_id}
+nickname = node%(node_id)s
web.port =
web.static = public_html
-tub.location = localhost:{tub_port}
+tub.location = localhost:%(tub_port)d
[client]
# Which services should this client connect to?
-introducer.furl = {furl}
+introducer.furl = %(furl)s
shares.needed = 2
shares.happy = 3
shares.total = 4
-'''.format(node_id=x, furl=furl, tub_port=(9900 + x)))
+''' % {'node_id':x, 'furl':furl, 'tub_port':(9900 + x)})
subprocess.check_call(
[
tahoe_bin, 'start', data_dir,
node_id = 0
for name in ['alice', 'bob']:
data_dir = join(data_base, name)
- magic_dir = join(data_base, '{}-magic'.format(name))
+ magic_dir = join(data_base, '%s-magic' % (name,))
mkdir(magic_dir)
if not exists(data_dir):
do_invites = True
with open(join(data_dir, 'tahoe.cfg'), 'w') as f:
f.write('''
[node]
-nickname = {name}
-web.port = tcp:998{node_id}:interface=localhost
+nickname = %(name)s
+web.port = tcp:998%(node_id)d:interface=localhost
web.static = public_html
[client]
# Which services should this client connect to?
-introducer.furl = {furl}
+introducer.furl = %(furl)s
shares.needed = 2
shares.happy = 3
shares.total = 4
-'''.format(name=name, node_id=node_id, furl=furl, magic_dir=magic_dir))
+''' % {'name':name, 'node_id':node_id, 'furl':furl})
subprocess.check_call(
[
tahoe_bin, 'start', data_dir,
if True:
for name in ['alice', 'bob']:
with open(join(data_base, name, 'private', 'magic_folder_dircap'), 'r') as f:
- print("dircap {}: {}".format(name, f.read().strip()))
+ print("dircap %s: %s" % (name, f.read().strip()))
# give storage nodes a chance to connect properly? I'm not entirely
# sure what's up here, but I get "UnrecoverableFileError" on the
print(" file contents still mismatched: %d bytes:\n" % (len(content),))
print(content)
else:
- print(" {} not there yet".format(alice_foo))
+ print(" %r not there yet" % (alice_foo,))
time.sleep(1)
# XXX test .backup (delete a file)
# ensure we still have a DB entry, and that the version is 1
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
- self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
+ self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
self.failUnlessEqual(metadata['version'], 1)
finally:
# ensure we still have a DB entry, and that the version is 1
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
- self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
+ self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
self.failUnlessEqual(metadata['version'], 1)
# restore the file, with different contents
# ensure we still have a DB entry, and that the version is 2
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
- self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
+ self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
self.failUnlessEqual(metadata['version'], 2)
finally: