File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ You have access to 3 configration keys:
8
8
* PAGE_SIZE: the default page size (default is 30)
9
9
* MAX_PAGE_SIZE: the maximum page size. If you speficy a page size greater than this value you will receive 400 Bad Request response.
10
10
* MAX_INCLUDE_DEPTH: the maximum length of an include through schema relationships
11
+ * ALLOW_DISABLE_PAGINATION: if you want to disallow to disable pagination you can set this configuration key to False
Original file line number Diff line number Diff line change @@ -111,6 +111,9 @@ def pagination(self):
111
111
except ValueError :
112
112
raise BadRequest ("Parse error" , source = {'parameter' : 'page[{}]' .format (key )})
113
113
114
+ if current_app .config .get ('ALLOW_DISABLE_PAGINATION' , True ) is False and int (result .get ('size' , 1 )) == 0 :
115
+ raise BadRequest ("You are not allowed to disable pagination" , source = {'parameter' : 'page[size]' })
116
+
114
117
if current_app .config .get ('MAX_PAGE_SIZE' ) is not None and 'size' in result :
115
118
if int (result ['size' ]) > current_app .config ['MAX_PAGE_SIZE' ]:
116
119
raise BadRequest ("Maximum page size is {}" .format (current_app .config ['MAX_PAGE_SIZE' ]),
You can’t perform that action at this time.
0 commit comments