-
-
Notifications
You must be signed in to change notification settings - Fork 958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"url_for" signature prevents use of "name" in path arguments #608
Comments
I’d suggest we change it to an unnamed argument. We could do this by changing the argument signature to *args, **kwargs, and ensuring that len(args) == 1 |
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 22, 2019
PR: #611 |
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 22, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 22, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 22, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 28, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 28, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 28, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 28, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Aug 28, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Sep 13, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Nov 19, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Nov 19, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Nov 28, 2019
dansan
added a commit
to dansan/starlette
that referenced
this issue
Nov 28, 2019
2 tasks
dansan
added a commit
to dansan/starlette
that referenced
this issue
Jan 1, 2022
dansan
added a commit
to dansan/starlette
that referenced
this issue
Jan 1, 2022
Rebased on top of current master. |
dansan
added a commit
to dansan/starlette
that referenced
this issue
Jan 31, 2022
dansan
added a commit
to dansan/starlette
that referenced
this issue
Jan 31, 2022
dansan
added a commit
to dansan/starlette
that referenced
this issue
Feb 8, 2022
dansan
added a commit
to dansan/starlette
that referenced
this issue
Feb 10, 2022
dansan
added a commit
to dansan/starlette
that referenced
this issue
Feb 14, 2022
dansan
added a commit
to dansan/starlette
that referenced
this issue
Feb 14, 2022
dansan
added a commit
to dansan/starlette
that referenced
this issue
Feb 14, 2022
I was hit by that issue just today and would like to see it merged. |
dansan
added a commit
to dansan/starlette
that referenced
this issue
Mar 9, 2022
dansan
added a commit
to dansan/starlette
that referenced
this issue
Mar 11, 2022
This comment was marked as spam.
This comment was marked as spam.
keul
added a commit
to ecmwf-projects/cads-catalogue-api-service
that referenced
this issue
Mar 17, 2023
This has been required by changes in starlette. See encode/starlette#608
cettina-tosto
pushed a commit
to ecmwf-projects/cads-catalogue-api-service
that referenced
this issue
Mar 24, 2023
This has been required by changes in starlette. See encode/starlette#608
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm implementing an API in Fastapi, using
APIRouter
s for different resources.When I want to get the URL of an item in a resource, I use the
starlette.requests.Request
objectsurl_for()
method.When I have a function with a path
/resource/{name}
I cannot useurl_for()
to get the URL, because it will result in:Reproduce with:
As a workaround I have renamed the path variable in my API, but
name
was really fitting, and what I wanted to use, and not at all an uncommon variable name.From what I see,
name
inurl_for()
seems to be the name of the referenced method inAPIRouter
. Changing the signature ofurl_for()
to userouter_method
instead ofname
, would make a collision with the key word arguments inpath_params
less likely. Result would be:An inspection on the used arguments could be used to log a deprecation warning until the next release, when
url_path_for()
is used with a namedname=...
instead of positional.If this proposal is acceptable, I'd create a PR.
The text was updated successfully, but these errors were encountered: