Skip to content

Can't get dependency_overrides to work #6515

Answered by Kludex
moshevayner asked this question in Questions
Discussion options

You must be logged in to vote

You cannot override dependencies that receive parameters. Well, you cannot override any dependency (object) that will have a different key value in a dictionary if you recreate it.

What you can do is:

x = FronteggSecurity(permissions=["foo"])

Then you use x as dependency e.g. Depends(x), and you can override it as well with app.dependency_overrides[x] = y.

Replies: 2 comments 3 replies

Comment options

Kludex
Feb 4, 2022
Collaborator Sponsor

You must be logged in to vote
3 replies
@jonfulk
Comment options

@jonfulk
Comment options

@jonfulk
Comment options

Answer selected by Kludex
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
3 participants
Converted from issue

This discussion was converted from issue #4511 on February 27, 2023 22:16.