Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mutalyzer
mutalyzer2
Commits
b425ae5c
Commit
b425ae5c
authored
May 24, 2018
by
Mihai
Browse files
Merge branch 'master' into nc_db
parents
afea80c1
312d5750
Changes
1
Hide whitespace changes
Inline
Side-by-side
mutalyzer/Retriever.py
View file @
b425ae5c
...
...
@@ -772,37 +772,23 @@ class LRGRetriever(Retriever):
def
fetch
(
self
,
name
):
"""
Fetch the LRG file and store in the cache directory. First try to
grab the file from the confirmed section, if this fails, get it
from the pending section.
Fetch the LRG file and store in the cache directory.
:arg unicode name: The name of the LRG file to fetch.
:returns: the full path to the file; None in case of an error.
:rtype: unicode
"""
prefix
=
settings
.
LRG_PREFIX_URL
url
=
prefix
+
'{}.xml'
.
format
(
name
)
pending_url
=
prefix
+
'pending/{}.xml'
.
format
(
name
)
url
=
'{}/{}.xml'
.
format
(
settings
.
LRG_PREFIX_URL
,
name
)
filename
=
None
try
:
return
self
.
downloadrecord
(
url
,
name
)
except
urllib2
.
URLError
:
# Catch error: file not found.
pass
try
:
# Try to get the file from the pending section.
filename
=
self
.
downloadrecord
(
pending_url
,
name
)
self
.
_output
.
addMessage
(
__file__
,
2
,
'WPEND'
,
'Warning: LRG file {} is a pending entry.'
.
format
(
name
))
return
filename
filename
=
self
.
downloadrecord
(
url
,
name
)
except
urllib2
.
URLError
:
self
.
_output
.
addMessage
(
__file__
,
4
,
'ERETR'
,
'Could not retrieve {}.'
.
format
(
name
))
# Explicit return in case of an Error.
return
Non
e
return
filenam
e
def
downloadrecord
(
self
,
url
,
name
=
None
):
"""
...
...
Write
Preview
Supports
Markdown
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