Skip to content

Commit

Permalink
Code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Dec 12, 2024
1 parent 547b1f4 commit 60579f0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/palace/manager/api/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class Axis360API(
# The name Axis 360 gives to its web interface. We use it as the
# name for the underlying access control system.
AXISNOW = "AxisNow"
BLIO = "Blio"

delivery_mechanism_to_internal_format = {
(epub, no_drm): "ePub",
Expand Down Expand Up @@ -980,9 +981,9 @@ def process_first(

class BibliographicParser(Axis360Parser[tuple[Metadata, CirculationData]], LoggerMixin):
DELIVERY_DATA_FOR_AXIS_FORMAT = {
"Blio": None, # Legacy format, handled the same way as AxisNow
Axis360API.BLIO: None, # Legacy format, handled the same way as AxisNow
"Acoustik": (None, DeliveryMechanism.FINDAWAY_DRM), # Audiobooks
"AxisNow": None, # Handled specially, for ebooks only.
Axis360API.AXISNOW: None, # Handled specially, for ebooks only.
"ePub": (Representation.EPUB_MEDIA_TYPE, DeliveryMechanism.ADOBE_DRM),
"PDF": (Representation.PDF_MEDIA_TYPE, DeliveryMechanism.ADOBE_DRM),
}
Expand Down Expand Up @@ -1226,7 +1227,7 @@ def extract_bibliographic(
informal_name = format_tag.text
seen_formats.append(informal_name)

if informal_name == "Blio":
if informal_name == Axis360API.BLIO:
# We will be adding an AxisNow FormatData.
blio_seen = True
continue
Expand Down Expand Up @@ -1568,6 +1569,9 @@ def process_one(

info: AxisLoanInfo | HoldInfo | None = None
if checked_out:
# When the item is checked out, it can be locked to a particular DRM format. So even though
# the item supports other formats, it can only be fulfilled in the format that was checked out.
# This format is returned in the checkoutFormat tag.
checkout_format = self.text_of_optional_subtag(
availability, "axis:checkoutFormat", ns
)
Expand All @@ -1582,7 +1586,7 @@ def process_one(
)

if not self.internal_format and (
checkout_format == self.api.AXISNOW or checkout_format == "Blio"
checkout_format == self.api.AXISNOW or checkout_format == self.api.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 can remove
Expand Down

0 comments on commit 60579f0

Please sign in to comment.