Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid assuming that access_url exists always #570

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pyvo/dal/adhoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,14 @@
yield current_batch.clone_byid(
id1,
original_row=row)
elif row.access_format == DATALINK_MIME_TYPE:
yield DatalinkResults.from_result_url(
row.getdataurl(),
original_row=row)
elif getattr(row, 'access_format', None) == DATALINK_MIME_TYPE:
yield DatalinkResults.from_result_url(row.getdataurl())

Check warning on line 227 in pyvo/dal/adhoc.py

View check run for this annotation

Codecov / codecov/patch

pyvo/dal/adhoc.py#L226-L227

Added lines #L226 - L227 were not covered by tests
else:
yield None
# Fall back to row-specific handling
try:
yield row.getdatalink()
except AttributeError:
yield None

Check warning on line 233 in pyvo/dal/adhoc.py

View check run for this annotation

Codecov / codecov/patch

pyvo/dal/adhoc.py#L230-L233

Added lines #L230 - L233 were not covered by tests


class DatalinkRecordMixin:
Expand Down