From fea55813c390aedc6086104fce6285352da94c9d Mon Sep 17 00:00:00 2001 From: Edwin Guzman Date: Tue, 23 Feb 2021 12:36:20 -0500 Subject: [PATCH 1/5] Updating core --- controller.py | 12 ++++++------ core | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/controller.py b/controller.py index 7f4c00b..8ef457d 100644 --- a/controller.py +++ b/controller.py @@ -22,7 +22,6 @@ from core.app_server import ( cdn_url_for, - feed_response, load_pagination_from_request, HeartbeatController, Pagination, @@ -68,6 +67,7 @@ from core.util.opds_writer import OPDSMessage from core.util.problem_detail import ProblemDetail from core.util.string_helpers import base64 +from core.util.flask_util import OPDSFeedResponse from coverage_provider import ( IdentifierResolutionCoverageProvider, @@ -484,7 +484,7 @@ def updates_feed(self, metadata_identifier): collection, **url_params ) - return feed_response(update_feed) + return OPDSFeedResponse(update_feed) def add_catalog_size_to_feed(self, feed, collection): """Add an tag to `feed` @@ -547,7 +547,7 @@ def add_items(self, metadata_identifier): precomposed_entries=messages ) - return feed_response(addition_feed) + return OPDSFeedResponse(addition_feed) def add_with_metadata(self, metadata_identifier): """Adds identifiers with their metadata to a Collection's catalog""" @@ -636,7 +636,7 @@ def add_with_metadata(self, metadata_identifier): precomposed_entries=messages ) - return feed_response(addition_feed) + return OPDSFeedResponse(addition_feed) def metadata_needed_for(self, metadata_identifier): """Returns identifiers in the collection that could benefit from @@ -696,7 +696,7 @@ def metadata_needed_for(self, metadata_identifier): 'metadata_needed_for', collection ) - return feed_response(request_feed) + return OPDSFeedResponse(request_feed) def remove_items(self, metadata_identifier): """Removes identifiers from a Collection's catalog""" @@ -749,7 +749,7 @@ def remove_items(self, metadata_identifier): precomposed_entries=messages ) - return feed_response(removal_feed) + return OPDSFeedResponse(removal_feed) def _in_catalog_subset(self, collection, identifiers_by_urn): """Helper method to find a subset of identifiers that diff --git a/core b/core index aa1f8b9..dcd4cc5 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit aa1f8b9e46fb2444a7a8a9b0776000fa3118631c +Subproject commit dcd4cc5f45ddec86822927acba68f9022432a700 From 13dfa34690c5858122d5d4c6725a6df3d93d37cd Mon Sep 17 00:00:00 2001 From: Edwin Guzman Date: Tue, 23 Feb 2021 14:32:50 -0500 Subject: [PATCH 2/5] Testing submodule update --- core | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core b/core index dcd4cc5..a19e86e 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit dcd4cc5f45ddec86822927acba68f9022432a700 +Subproject commit a19e86efce6061548108a9164877277d12d4c195 diff --git a/requirements.txt b/requirements.txt index 7df5095..8f2dcc3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,7 +24,7 @@ money pymarc accept-types watchtower # for cloudwatch logging -pyspellchecker +pyspellchecker==0.5.6 # nltk is a textblob dependency, and this is the last release that supports Python 2 nltk==3.4.5 From c21ff5a9d09e8ba52ecbf76e600ad5859cf8164d Mon Sep 17 00:00:00 2001 From: Edwin Guzman Date: Tue, 23 Feb 2021 14:55:03 -0500 Subject: [PATCH 3/5] Minor update for ExternalIntegrationLink reference --- coverage_utils.py | 2 +- tests/test_coverage_utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coverage_utils.py b/coverage_utils.py index e16872f..1cae636 100644 --- a/coverage_utils.py +++ b/coverage_utils.py @@ -44,7 +44,7 @@ def from_db(cls, _db, **kwargs): ) mirror = None mirrors = { ExternalIntegrationLink.COVERS : mirror, - ExternalIntegrationLink.BOOKS : None } + ExternalIntegrationLink.OPEN_ACCESS_BOOKS : None } return cls.from_metadata_source( mirrors=mirrors, **kwargs ) diff --git a/tests/test_coverage_utils.py b/tests/test_coverage_utils.py index 97addf4..5b0ac0e 100644 --- a/tests/test_coverage_utils.py +++ b/tests/test_coverage_utils.py @@ -71,7 +71,7 @@ def test_from_db(self): # But the MirrorUploader is only to be used for book covers. The # metadata wrangler ignores the books themselves. - eq_(None, mirrors[ExternalIntegrationLink.BOOKS]) + eq_(None, mirrors[ExternalIntegrationLink.OPEN_ACCESS_BOOKS]) class TestMetadataWranglerBibliographicCoverageProvider(S3UploaderTest): From cb22fdff600204b723ba4d902fa487a08495f40c Mon Sep 17 00:00:00 2001 From: Edwin Guzman Date: Tue, 23 Feb 2021 15:42:19 -0500 Subject: [PATCH 4/5] Fixing test --- tests/test_overdrive.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_overdrive.py b/tests/test_overdrive.py index 92586b9..45bff93 100644 --- a/tests/test_overdrive.py +++ b/tests/test_overdrive.py @@ -3,6 +3,7 @@ eq_, set_trace, ) +import urllib from core.metadata_layer import ReplacementPolicy from core.s3 import MockS3Uploader from core.testing import ( @@ -52,10 +53,10 @@ def test_replacement_policy_uses_provided_mirror(self): # Now let's try looking up a specific identifier through 'Overdrive'. identifier = self._identifier( - Identifier.OVERDRIVE_ID, "3896665d-9d81-4cac-bd43-ffc5066de1f5" + identifier_type=Identifier.OVERDRIVE_ID, + foreign_id="3896665d-9d81-4cac-bd43-ffc5066de1f5" ) - body = self.data_file("overdrive/overdrive_metadata.json") provider.api.queue_response(200, {}, body) @@ -79,9 +80,9 @@ def test_replacement_policy_uses_provided_mirror(self): # The URLs for the Resource objects are our S3 URLs, not Overdrive's # URLs. - expect = "Overdrive/Overdrive+ID/%s" % identifier.identifier + expect = "Overdrive/Overdrive ID/%s" % identifier.identifier for url in [full.mirror_url, thumbnail.mirror_url]: - assert expect in url + assert urllib.quote(expect) in url assert "/scaled/" in thumbnail.mirror_url assert "/scaled/" not in full.mirror_url From b0dfe7f32f080e3acc9d224c1184004e05429a05 Mon Sep 17 00:00:00 2001 From: Edwin Guzman Date: Tue, 23 Feb 2021 15:46:38 -0500 Subject: [PATCH 5/5] Adding parameterized --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 8f2dcc3..12a5200 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,6 +25,7 @@ pymarc accept-types watchtower # for cloudwatch logging pyspellchecker==0.5.6 +parameterized # nltk is a textblob dependency, and this is the last release that supports Python 2 nltk==3.4.5