mirror of
https://github.com/simonw/datasette.git
synced 2026-11-27 04:19:42 +01:00
Unify page-size parameters on _size with table semantics
The stored query lists silently clamped out-of-range ?_size= values (a request for 5000 quietly returned 1000) and did not accept the max keyword. They now share the table view semantics via a new parse_size_limit() helper: blank means default, "max" means the maximum (max_returned_rows for query lists), negative or non-integer values are a 400, and values over the maximum are a 400 instead of being silently clamped. The /-/allowed and /-/rules debug endpoints renamed their bare page/page_size parameters to _page/_size, matching the underscore grammar used by every other system parameter, with the same validation (400 instead of silently capping page_size at 200). Their HTML debug pages and next_url/previous_url builders use the new names. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GrHZSypDfMnym1tM5XJAFZ
This commit is contained in:
parent
404ee4c3a7
commit
3a0ea58557
13 changed files with 137 additions and 63 deletions
|
|
@ -1363,12 +1363,12 @@ async def test_permission_debug_tabs_with_query_string(ds_client):
|
|||
|
||||
# Test /-/allowed with query string
|
||||
response = await ds_client.get(
|
||||
"/-/allowed?action=view-table&page_size=50", actor=actor
|
||||
"/-/allowed?action=view-table&_size=50", actor=actor
|
||||
)
|
||||
assert response.status_code == 200
|
||||
# Check that Rules and Check tabs have the query string
|
||||
assert 'href="/-/rules?action=view-table&page_size=50"' in response.text
|
||||
assert 'href="/-/check?action=view-table&page_size=50"' in response.text
|
||||
assert 'href="/-/rules?action=view-table&_size=50"' in response.text
|
||||
assert 'href="/-/check?action=view-table&_size=50"' in response.text
|
||||
# Playground and Actions should not have query string
|
||||
assert 'href="/-/permissions"' in response.text
|
||||
assert 'href="/-/actions"' in response.text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue