Skip to content
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

Fix callback order for nested blueprints #4230

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

matipau
Copy link

@matipau matipau commented Aug 9, 2021

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

@davidism
Copy link
Member

@pgjones can you check this? Seems to go against the discussion of request.blueprints order that we had.

@pgjones
Copy link
Member

pgjones commented Aug 10, 2021

I can't remember the details of the discussion that led to the current order. I do think before-functions going from app down and after-functions going from app up makes more sense though.

@davidism davidism added this to the 2.0.2 milestone Oct 1, 2021
@davidism davidism changed the base branch from main to 2.0.x October 4, 2021 03:22
Handlers registered via url_value_preprocessor, before_request,
context_processor, and url_defaults are called in downward order: First
on the app and last on the current blueprint.

Handlers registered via after_request and teardown_request are called
in upward order: First on the current blueprint and last on the app.
avoid building nested chain iterables
avoid triggering defaultdict when looking up registries
apply functions as they are looked up
@davidism
Copy link
Member

davidism commented Oct 4, 2021

I added a changelog, rebased this to 2.0.x, and did a bit more refactoring.

@davidism davidism merged commit 6d637f0 into pallets:2.0.x Oct 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handlers are called in wrong order when using nested blueprints
3 participants