Skip to content

Commit 20ca93b

Browse files
committed
Limit listings to 150 items.
Works around bots generating excessive traffic by stepping through all listing pages. syslabcom/scrum#2211
1 parent ec9d5b4 commit 20ca93b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/recensio/plone/browser/listing.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def portal_path(self):
2626
class ListingBase(BrowserView):
2727
"""Base class for listing views."""
2828

29+
limit = 150
30+
2931
def punctuated_title_and_subtitle(self, obj):
3032
return punctuated_title_and_subtitle(obj)
3133

@@ -45,7 +47,7 @@ def rss_url(self):
4547
@property
4648
def items(self):
4749
catalog = api.portal.get_tool("portal_catalog")
48-
results = catalog(self.query)
50+
results = catalog(self.query, sort_limit=self.limit)[: self.limit]
4951
IAnnotations(self.request)["recensio.query_results"] = results
5052
results = IContentListing(results)
5153
return results

0 commit comments

Comments
 (0)