diff --git a/core/lane.py b/core/lane.py index 6af0a00d4..20d5e75bd 100644 --- a/core/lane.py +++ b/core/lane.py @@ -553,9 +553,7 @@ def __init__( self.collection_name = collection_name or self.default_facet( library, self.COLLECTION_NAME_FACETS_GROUP_NAME ) - self.language: str = language or self.default_facet( - library, self.LANGUAGE_FACET_GROUP_NAME - ) + self.language: str = language if order_ascending == self.ORDER_ASCENDING: order_ascending = True elif order_ascending == self.ORDER_DESCENDING: @@ -727,7 +725,9 @@ def modify_search_filter(self, filter): filter.subcollection = self.collection # Finland - if self.language and self.language != self.LANGUAGE_ALL: + if self.language == self.LANGUAGE_ALL: + filter.languages = [] + elif self.language: filter.languages = [self.language] # We can only have distributor and collection name facets if we have a library diff --git a/tests/api/feed/test_opds_acquisition_feed.py b/tests/api/feed/test_opds_acquisition_feed.py index 22b9f6c2a..9ee466f8f 100644 --- a/tests/api/feed/test_opds_acquisition_feed.py +++ b/tests/api/feed/test_opds_acquisition_feed.py @@ -1151,7 +1151,7 @@ def run(wl=None, facets=None, pagination=None): # The make_link function that was passed in calls # TestAnnotator.feed_url() when passed an EntryPoint. The # Facets object's other facet groups are propagated in this URL. - first_page_url = "http://wl/?available=all&collection=full&collectionName=All&distributor=All&entrypoint=Book&language=all&order=author" + first_page_url = "http://wl/?available=all&collection=full&collectionName=All&distributor=All&entrypoint=Book&order=author" assert first_page_url == make_link(EbooksEntryPoint) # Pagination information is not propagated through entry point links diff --git a/tests/api/test_lanes.py b/tests/api/test_lanes.py index 5c4a35219..7ea65430c 100644 --- a/tests/api/test_lanes.py +++ b/tests/api/test_lanes.py @@ -908,7 +908,7 @@ def test_default(self, db: DatabaseTransactionFixture): assert facets.collection == CrawlableFacets.COLLECTION_FULL assert facets.availability == CrawlableFacets.AVAILABLE_ALL assert facets.order == CrawlableFacets.ORDER_LAST_UPDATE - assert facets.language == CrawlableFacets.LANGUAGE_ALL + assert facets.language is None assert facets.order_ascending is False [ @@ -921,7 +921,7 @@ def test_default(self, db: DatabaseTransactionFixture): ] = facets.enabled_facets # The default facets are the only ones enabled. - for facet in [order, availability, collection, language]: + for facet in [order, availability, collection]: assert len(facet) == 1 # Except for distributor and collectionName, which have the default diff --git a/tests/core/test_lane.py b/tests/core/test_lane.py index f426aba98..401372e3e 100644 --- a/tests/core/test_lane.py +++ b/tests/core/test_lane.py @@ -360,7 +360,7 @@ def test_facet_groups(self, db: DatabaseTransactionFixture): ["collectionName", db.default_collection().name, False], ["distributor", "All", True], ["distributor", DataSource.AMAZON, False], - ["language", "all", True], + ["language", "all", False], ["language", "eng", False], ["language", "fin", False], ["language", "others", False],