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
Merlijn Wajer
Python Derivermodule
Commits
db6e6d9d
Commit
db6e6d9d
authored
Dec 04, 2020
by
Merlijn Wajer
Browse files
scandata: ensure that returned path is a string
parent
c6a57ee7
Changes
1
Hide whitespace changes
Inline
Side-by-side
derivermodule/scandata.py
View file @
db6e6d9d
...
...
@@ -18,7 +18,7 @@ def get_scandata_xml(identifier, source_file):
* identifier (str): Identifier of the item
* source_file (str): sourceFile to be operated on
Returns the path to the scandata (str)
.
Returns the path to the scandata (str)
or None
"""
item_dir
=
Path
(
PB_ITEM
)
...
...
@@ -32,11 +32,11 @@ def get_scandata_xml(identifier, source_file):
source_xml_path
=
Path
(
f
'
{
source_file
.
rsplit
(
"_"
,
1
)[
0
]
}
_scandata.xml'
)
if
source_xml_path
.
exists
():
return
source_xml_path
return
str
(
source_xml_path
)
elif
identifier_xml_path
.
exists
():
return
identifier_xml_path
return
str
(
identifier_xml_path
)
elif
raw_xml_path
.
exists
():
return
raw_xml_path
return
str
(
raw_xml_path
)
elif
zip_path
.
exists
():
try
:
# XXX: We don't clean up the temporary directory when we're done,
...
...
@@ -50,7 +50,7 @@ def get_scandata_xml(identifier, source_file):
logger
.
warning
(
'Unable to extract scandata.xml from scandata.zip'
)
logger
.
exception
(
e
)
return
None
return
xml_path
return
str
(
xml_path
)
logger
.
warning
(
f
'Unable to find scandata file'
)
return
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