diff --git a/src/palace/manager/api/axis.py b/src/palace/manager/api/axis.py index ba031821d..67e0f4e4c 100644 --- a/src/palace/manager/api/axis.py +++ b/src/palace/manager/api/axis.py @@ -1568,6 +1568,9 @@ def process_one( info: AxisLoanInfo | HoldInfo | None = None if checked_out: + checkout_format = self.text_of_optional_subtag( + availability, "axis:checkoutFormat", ns + ) start_date = self._xpath1_date(availability, "axis:checkoutStartDate", ns) end_date = self._xpath1_date(availability, "axis:checkoutEndDate", ns) download_url = self.text_of_optional_subtag( @@ -1578,6 +1581,14 @@ def process_one( or "" ) + if not self.internal_format and ( + checkout_format == self.api.AXISNOW or checkout_format == "Blio" + ): + # If we didn't explicitly ask for a format, ignore any AxisNow or Blio formats, since + # we can't fulfill them. If we add AxisNow and Blio support in the future, we will need + # to drop this line. + return None + fulfillment: Fulfillment | None if download_url and self.internal_format != self.api.AXISNOW: # The patron wants a direct link to the book, which we can deliver diff --git a/tests/manager/api/test_axis.py b/tests/manager/api/test_axis.py index b8f2e44ef..296a8b50f 100644 --- a/tests/manager/api/test_axis.py +++ b/tests/manager/api/test_axis.py @@ -485,7 +485,7 @@ def test_fulfill(self, axis360: Axis360Fixture): pytest.raises(NoActiveLoan, fulfill) # If an ebook is checked out and we're not asking for it to be - # fulfilled through AxisNow, we get a Axis360AcsFulfillment + # fulfilled through Adobe DRM, we get a Axis360AcsFulfillment # object with a content link. data = axis360.sample_data("availability_with_loan_and_hold.xml") axis360.api.queue_response(200, content=data) @@ -551,6 +551,12 @@ def test_patron_activity(self, axis360: Axis360Fixture): assert isinstance(hold2, HoldInfo) assert isinstance(loan, LoanInfo) + # If the activity includes something with a Blio format, it is not included in the results. + data = axis360.sample_data("availability_with_axisnow_fulfillment.xml") + axis360.api.queue_response(200, content=data) + results = axis360.api.patron_activity(patron, "pin") + assert len(results) == 0 + def test_update_licensepools_for_identifiers(self, axis360: Axis360Fixture): class Mock(MockAxis360API): """Simulates an Axis 360 API that knows about some