Skip to content

Commit

Permalink
Merge branch 'master' into isort
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico authored Nov 17, 2023
2 parents 9ac575b + 665103a commit 4ea6af8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
15 changes: 11 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
Changelog
=========

5.3.1 (unreleased)
5.4.1 (unreleased)
------------------

- Isort
[folix-01]


5.4.0 (2023-11-14)
------------------

- Return error instead of raise Excpetion for BadRequest in querystringsearch
[mamico]

- Add upgrade step and setuphandler to fix robots.txt
original rules adding 'Allow: /*?expand*'
[lucabel]

- Isort
[folix-01]

5.3.0 (2023-10-25)
------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="redturtle.volto",
version="5.3.1.dev0",
version="5.4.1.dev0",
description="Helper package to setup a RedTurtle's Plone site ready to work with Volto.",
long_description=long_description,
# Get more from https://pypi.org/classifiers/
Expand Down
12 changes: 8 additions & 4 deletions src/redturtle/volto/restapi/services/querystringsearch/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,20 @@ def __call__(self):
try:
b_start = int(data.get("b_start", 0))
except ValueError:
raise BadRequest("Invalid b_start")
self.request.response.setStatus(400)
return dict(error=dict(type="BadRequest", message="Invalid b_start"))
try:
b_size = int(data.get("b_size", 25))
except ValueError:
raise BadRequest("Invalid b_size")
self.request.response.setStatus(400)
return dict(error=dict(type="BadRequest", message="Invalid b_size"))
sort_on = data.get("sort_on", None)
sort_order = data.get("sort_order", None)

# LIMIT PATCH
if not query:
raise BadRequest("No query supplied")
self.request.response.setStatus(400)
return dict(error=dict(type="BadRequest", message="No query supplied"))
limit = self.get_limit(data=data)
# END OF LIMIT PATCH

Expand Down Expand Up @@ -86,7 +89,8 @@ def __call__(self):
# This can happen if the query has an invalid operation,
# but plone.app.querystring doesn't raise an exception
# with specific info.
raise BadRequest("Invalid query.")
self.request.response.setStatus(400)
return dict(error=dict(type="BadRequest", message="Invalid query"))

results = getMultiAdapter((results, self.request), ISerializeToJson)(
fullobjects=fullobjects
Expand Down

0 comments on commit 4ea6af8

Please sign in to comment.