Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

update setupmethod behavior#4577

Merged
davidism merged 3 commits intopallets:mainfrom
hallacy:hallacy/fix_4571
May 23, 2022
Merged

update setupmethod behavior#4577
davidism merged 3 commits intopallets:mainfrom
hallacy:hallacy/fix_4571

Conversation

@hallacy
Copy link
Contributor

@hallacy hallacy commented May 2, 2022

Addresses #4571 by

  • Removing warn_on_modifications from blueprint.py so that warnings aren't ignorable
  • Adds a TODO and modifies the warning to inform users that the warning from blueprints.py will be an error in 2.3
  • Adds @setupmethod calls to route and endpoint to check places where reregistering would be bad.

Checklist:

(I owe a bunch of these but since is my first change, I'd like to sanity check that I'm on the right path before digging in more if thats ok)

  • 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 davidism changed the title Hallacy/fix 4571 update setupmethod behavior May 2, 2022
@davidism davidism force-pushed the hallacy/fix_4571 branch from 3751104 to 3dec195 Compare May 20, 2022 15:23
@davidism davidism force-pushed the hallacy/fix_4571 branch from 3dec195 to ee59c05 Compare May 23, 2022 15:51
@davidism
Copy link
Member

Thanks for working on this. I added some more changes on top of your changes to the blueprint behavior.

  • Added @setupmethod above all relevant methods. This ensures the error is raised closer to the decorator, when previously it might be raised by an internal call to another setup method.
  • Refactored setupmethod to call Scaffold._check_setup_finished, which now does the check and raises the error. This allows Flask and Blueprint to show different messages.
  • Refactored tests that performed setup after requests (including some that changed config, although this isn't an error right now).

@davidism davidism added this to the 2.2.0 milestone May 23, 2022
@davidism davidism force-pushed the hallacy/fix_4571 branch from ee59c05 to e044b00 Compare May 23, 2022 16:09
@davidism davidism merged commit a52a7db into pallets:main May 23, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2022
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.

Unify setupmethod behavior between Flask and Blueprint

2 participants