Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ideascube
ARCHIVED Kiwix Hotspot
Commits
b61b7177
Commit
b61b7177
authored
Jul 09, 2018
by
rgaudin
Browse files
allow retrieval of files without checksum
parent
4ce1e8a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
pibox-installer/backend/download.py
View file @
b61b7177
...
...
@@ -43,7 +43,7 @@ class RequestedFile(object):
return
rf
@
classmethod
def
from_disk
(
cls
,
url
,
fpath
,
checksum
):
def
from_disk
(
cls
,
url
,
fpath
,
checksum
=
None
):
rf
=
cls
(
url
,
fpath
)
rf
.
checksum
=
checksum
rf
.
set
(
cls
.
FOUND
)
...
...
@@ -75,7 +75,8 @@ class RequestedFile(object):
@
property
def
verified
(
self
):
return
self
.
present
and
get_checksum
(
self
.
fpath
)
==
self
.
checksum
return
self
.
present
and
(
get_checksum
(
self
.
fpath
)
==
self
.
checksum
or
self
.
checksum
==
None
)
def
stream
(
url
,
write_to
=
None
,
callback
=
None
,
block_size
=
1024
):
...
...
@@ -144,6 +145,8 @@ def download_if_missing(url, fpath, logger, checksum=None):
logger
.
std
(
"MATCH."
)
return
RequestedFile
.
from_disk
(
url
,
fpath
,
checksum
)
logger
.
std
(
"MISMATCH."
)
elif
os
.
path
.
exists
(
fpath
):
return
RequestedFile
.
from_disk
(
url
,
fpath
)
return
download_file
(
url
,
fpath
,
logger
,
checksum
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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