tornadoweb / tornadoweb/tornado
Laziness of RequestHandler.current_user
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 22.2k
- Forks
- 5.6k
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 16
Description
The RequestHandler.current_user getter defers the evaluation of RequestHandler.get_current_user until it's needed. However, when either RequestHandler.get_template_namespace or UIModule.init is called, the current_user getter is called, and get_current_user is evaluated. This should be avoided, since the current request might not need the current user at all, and get_current_user might be expensive to evaluate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the RequestHandler.current_user getter and its interactions with RequestHandler.get_template_namespace and UIModule.init. Verify where get_current_user is evaluated during template namespace and UI module setup. Done means those paths preserve lazy evaluation and only evaluate the current user when the getter is actually needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100