def upload(self, path, hash): fullpath = join(self.syncdir, path) if hash == 'DEL': client.delete_object(self.container, path) elif hash == 'DIR': client.create_directory_marker(self.container, path) else: prefix, name = split(path) if prefix: prefix += '/' print 'Uploading %s...' % path upload(client, fullpath, self.container, prefix, name) remote = self.remote_hash(path) assert remote == hash, "Uploaded file does not match hash" self.save(path, hash)
def execute(self, file, path): container, sep, prefix = path.partition('/') upload(self.client, file, container, prefix)