simonw / simonw/datasette

`request.post_vars()` cannot handle multiple values for a key

Open Beginner friendly
#2,425 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement internals
Dominant language
Python
Stars
11.5k
Forks
903
Avg merge
4d 17h
Merged PRs (30d)
18

Description

https://github.com/simonw/datasette/blob/832f76ce26ffb2f3e27a006ff90254374bd90e61/datasette/utils/asgi.py#L138-L140

Datasette GET requests often use ?_facet=category&_facet=size - but right now there's no neat way to handle that with POST data, since this code reduces any multiple values to just one.

This came up while working with <select multiple> (enhanced using Choices.js) in:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at datasette/utils/asgi.py lines 138-140 and trace request.post_vars() for repeated POST keys, using the linked datasette-acl multiple-select context as a reproduction. Done means repeated values are preserved rather than reduced to one, matching the need for POST data equivalent to repeated GET parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.