Revision f17121cd kamaki/clients/pithos/__init__.py

b/kamaki/clients/pithos/__init__.py
520 520
        if not content_type:
521 521
            content_type = 'application/octet-stream'
522 522

  
523
        num_of_blocks, blockmod = size / blocksize, size % blocksize
524
        num_of_blocks += (1 if blockmod else 0) if num_of_blocks else blockmod
525

  
526 523
        hashes = []
527 524
        hmap = {}
528
        for blockid in range(num_of_blocks):
525
        for blockid in range(nblocks):
529 526
            start = blockid * blocksize
530 527
            block = input_str[start: (start + blocksize)]
531 528
            hashes.append(_pithos_hash(block, blockhash))
......
547 544
        num_of_missing = len(missing)
548 545

  
549 546
        if upload_cb:
550
            self.progress_bar_gen = upload_cb(num_of_blocks)
551
            for i in range(num_of_blocks + 1 - num_of_missing):
547
            self.progress_bar_gen = upload_cb(nblocks)
548
            for i in range(nblocks + 1 - num_of_missing):
552 549
                self._cb_next()
553 550

  
554 551
        tries = 7

Also available in: Unified diff