mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd730a391a | ||
|
|
6f0f85bcf1 | ||
|
|
53d8cd708a |
5 changed files with 27 additions and 3 deletions
|
|
@ -1,2 +1,2 @@
|
||||||
__version__ = "0.54"
|
__version__ = "0.54.1"
|
||||||
__version_info__ = tuple(__version__.split("."))
|
__version_info__ = tuple(__version__.split("."))
|
||||||
|
|
|
||||||
|
|
@ -815,7 +815,7 @@ class TableView(RowTableShared):
|
||||||
|
|
||||||
form_hidden_args = []
|
form_hidden_args = []
|
||||||
for key in request.args:
|
for key in request.args:
|
||||||
if key.startswith("_"):
|
if key.startswith("_") and key not in ("_sort", "_search"):
|
||||||
for value in request.args.getlist(key):
|
for value in request.args.getlist(key):
|
||||||
form_hidden_args.append((key, value))
|
form_hidden_args.append((key, value))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@
|
||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
.. _v0_54_1:
|
||||||
|
|
||||||
|
0.54.1 (2021-02-02)
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Fixed a bug where ``?_search=`` and ``?_sort=`` parameters were incorrectly duplicated when the filter form on the table page was re-submitted. (`#1214 <https://github.com/simonw/datasette/issues/1214>`__)
|
||||||
|
|
||||||
.. _v0_54:
|
.. _v0_54:
|
||||||
|
|
||||||
0.54 (2021-01-25)
|
0.54 (2021-01-25)
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ Here's a test for that plugin that mocks the HTTPX outbound request:
|
||||||
response = await datasette.client.post("/-/fetch-url", data={
|
response = await datasette.client.post("/-/fetch-url", data={
|
||||||
"url": "https://www.example.com/"
|
"url": "https://www.example.com/"
|
||||||
})
|
})
|
||||||
asert response.text == "Hello world"
|
assert response.text == "Hello world"
|
||||||
|
|
||||||
outbound_request = httpx_mock.get_request()
|
outbound_request = httpx_mock.get_request()
|
||||||
assert outbound_request.url == "https://www.example.com/"
|
assert outbound_request.url == "https://www.example.com/"
|
||||||
|
|
|
||||||
|
|
@ -1272,6 +1272,23 @@ def test_other_hidden_form_fields(app_client, path, expected_hidden):
|
||||||
assert [(hidden["name"], hidden["value"]) for hidden in hiddens] == expected_hidden
|
assert [(hidden["name"], hidden["value"]) for hidden in hiddens] == expected_hidden
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"path,expected_hidden",
|
||||||
|
[
|
||||||
|
("/fixtures/searchable?_search=terry", []),
|
||||||
|
("/fixtures/searchable?_sort=text2", []),
|
||||||
|
("/fixtures/searchable?_sort=text2&_where=1", [("_where", "1")]),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_search_and_sort_fields_not_duplicated(app_client, path, expected_hidden):
|
||||||
|
# https://github.com/simonw/datasette/issues/1214
|
||||||
|
response = app_client.get(path)
|
||||||
|
soup = Soup(response.body, "html.parser")
|
||||||
|
inputs = soup.find("form").findAll("input")
|
||||||
|
hiddens = [i for i in inputs if i["type"] == "hidden"]
|
||||||
|
assert [(hidden["name"], hidden["value"]) for hidden in hiddens] == expected_hidden
|
||||||
|
|
||||||
|
|
||||||
def test_binary_data_display_in_table(app_client):
|
def test_binary_data_display_in_table(app_client):
|
||||||
response = app_client.get("/fixtures/binary_data")
|
response = app_client.get("/fixtures/binary_data")
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue