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
Merret Buurman
pidlandingpage
Commits
232d4961
Commit
232d4961
authored
Sep 13, 2016
by
Merret Buurman
Browse files
Catch error if child handle record cannot be retrieved.
parent
a712e35e
Changes
1
Hide whitespace changes
Inline
Side-by-side
landingpage/landingpageapp/handle/cmip6parser.py
View file @
232d4961
...
@@ -303,10 +303,22 @@ def _get_list_of_parts_records_from_record(record):
...
@@ -303,10 +303,22 @@ def _get_list_of_parts_records_from_record(record):
list_to_be_returned
=
[]
list_to_be_returned
=
[]
any_replaced
=
False
any_replaced
=
False
for
handle
in
list_of_parts_handles
:
for
handle
in
list_of_parts_handles
:
info
,
replaced
=
_extract_info_on_one_part_record
(
handle
)
try
:
list_to_be_returned
.
append
(
info
)
info
,
replaced
=
_extract_info_on_one_part_record
(
handle
)
if
replaced
:
list_to_be_returned
.
append
(
info
)
any_replaced
=
True
if
replaced
:
any_replaced
=
True
except
ValueError
:
# If we cannot access the child record, do not
# append anything, just leave this one out.
pass
# If no child handle record could be retrieved, but there is children,
# return None to show that something went wrong.
if
len
(
list_to_be_returned
)
==
0
and
len
(
list_of_parts_handles
)
>
0
:
list_to_be_returned
=
None
any_replaced
=
None
return
list_to_be_returned
,
any_replaced
return
list_to_be_returned
,
any_replaced
def
_extract_info_on_one_part_record
(
handle
):
def
_extract_info_on_one_part_record
(
handle
):
...
...
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