Revision cb446fb8 tools/lib/transfer.py

b/tools/lib/transfer.py
97 97
        open(path, 'w').close()     # Create an empty file
98 98
        hashes = []
99 99
    
100
    if bytes == 0:
101
        return
102
    
103 100
    with open(path, 'a+') as fp:
104
        for i, h in enumerate(map):
105
            if i < len(hashes) and h == hashes[i]:
106
                continue
107
            start = i * blocksize
108
            end = '' if i == len(map) - 1 else ((i + 1) * blocksize) - 1
109
            data = client.retrieve_object(container, object, range='bytes=%s-%s' % (start, end))
110
            if i != len(map) - 1:
111
                data += (blocksize - len(data)) * '\x00'
112
            fp.seek(start)
113
            fp.write(data)
101
        if bytes != 0:
102
            for i, h in enumerate(map):
103
                if i < len(hashes) and h == hashes[i]:
104
                    continue
105
                start = i * blocksize
106
                end = '' if i == len(map) - 1 else ((i + 1) * blocksize) - 1
107
                data = client.retrieve_object(container, object, range='bytes=%s-%s' % (start, end))
108
                if i != len(map) - 1:
109
                    data += (blocksize - len(data)) * '\x00'
110
                fp.seek(start)
111
                fp.write(data)
112
        fp.truncate(bytes)

Also available in: Unified diff