Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
90099c14
Commit
90099c14
authored
May 21, 2013
by
Stavros Sachtouris
Browse files
Do not recalculate #blocks in upload_from_string
Refs: #3608
parent
36778d79
Changes
1
Hide whitespace changes
Inline
Side-by-side
kamaki/clients/pithos/__init__.py
View file @
90099c14
...
...
@@ -495,12 +495,9 @@ class PithosClient(PithosRestClient):
if
not
content_type
:
content_type
=
'application/octet-stream'
num_of_blocks
,
blockmod
=
size
/
blocksize
,
size
%
blocksize
num_of_blocks
+=
(
1
if
blockmod
else
0
)
if
num_of_blocks
else
blockmod
hashes
=
[]
hmap
=
{}
for
blockid
in
range
(
n
um_of_
blocks
):
for
blockid
in
range
(
nblocks
):
start
=
blockid
*
blocksize
block
=
input_str
[
start
:
(
start
+
blocksize
)]
hashes
.
append
(
_pithos_hash
(
block
,
blockhash
))
...
...
@@ -522,8 +519,8 @@ class PithosClient(PithosRestClient):
num_of_missing
=
len
(
missing
)
if
upload_cb
:
self
.
progress_bar_gen
=
upload_cb
(
n
um_of_
blocks
)
for
i
in
range
(
n
um_of_
blocks
+
1
-
num_of_missing
):
self
.
progress_bar_gen
=
upload_cb
(
nblocks
)
for
i
in
range
(
nblocks
+
1
-
num_of_missing
):
self
.
_cb_next
()
tries
=
7
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment