-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
django-stubs: Fix Promise related typing errors. #22665
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timabbott
reviewed
Aug 5, 2022
timabbott
reviewed
Aug 5, 2022
74f51ee
to
8ec955c
Compare
andersk
reviewed
Aug 9, 2022
This is mostly blocked on but if you’d like to move the import fix into a new PR, that might be worth merging sooner. |
12 tasks
03fbc93
to
c4055ba
Compare
timabbott
reviewed
Aug 18, 2022
Signed-off-by: Zixuan James Li <[email protected]>
This uses a more specific type `_StrPromise` to replace `Promise` providing typing information for lazy translation strings. In places where the callee evaluates the `_StrPromise` object in all cases we simply force the evaluation with `str()`. This includes `JsonableError` that ends up handled by the error handler middleware, and `internal_send_stream_message` that depends on `check_stream_topic`, requiring the `topic` to be evaluated anyway. In other siuations, the callee is expected to be able to handle `StrPromise` explicitly. Signed-off-by: Zixuan James Li <[email protected]>
The above mentioned issue with the validator is fixed in 18a055124a2212e13c97bc1a83cc36b4e8104a97, along with the implementation of |
andersk
approved these changes
Aug 29, 2022
Merged, thanks @PIG208! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This discussion for this solution can be found here.
gettext_lazy
returnsPromise
objects that is actually different fromstr
. Methods that are present onstr
can also be accessed on such objects. And it behaves like astr
except that it is not an instance ofstr
.Affected errors:
Screenshots and screen captures:
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: