tornadoweb / tornadoweb/tornado

Laziness of RequestHandler.current_user

Open
#820 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

web
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.