Skip to content

Conversation

davidism
Copy link
Member

@davidism davidism commented Dec 24, 2021

It should be possible to pass a list value to a custom URL converter when building. However, after some other changes to the code to support MultiDict, a regression was introduced that made that difficult.

This changes the behavior so flattening single-item lists only happens when passing MultiDict, where values will always be lists, and are mainly coming from request.args where this behavior makes sense. For plain dicts, neither of these things are done, it is assumed that the user will intentionally pass a list or single item depending on what's appropriate.

Additionally, build no longer filters None items from list values. Either the list will be passed to a URL converter, where it's the converter's job to handle the value passed to it, or it's a query arg, and url_encode already filters out None.

fixes #2249
continues #2261

@davidism davidism added this to the 2.1.0 milestone Dec 24, 2021
@davidism davidism force-pushed the url-build-list branch 3 times, most recently from 6bf8212 to 6bcc85a Compare December 25, 2021 18:00
@davidism davidism merged commit bfa6c97 into main Dec 25, 2021
@davidism davidism deleted the url-build-list branch December 25, 2021 18:13
@Yourun-proger
Copy link
Contributor

🎉 Yeah!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MapAdapter.build() should not flatten a value passed as single-item-list
2 participants