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

Pass arguments to the Blueprint constructor in the correct order #62

Merged
merged 1 commit into from
Jun 3, 2021
Merged

Pass arguments to the Blueprint constructor in the correct order #62

merged 1 commit into from
Jun 3, 2021

Conversation

owenniles
Copy link
Contributor

According to the Flask API documentation, the Blueprint constructor expects to receive name as its first argument and import_name as its second argument.

It looks like there is a typo in the existing HireFire code, as __name__—a suitable value for import_name—is passed as the first argument, while the string "hirefire"—a suitable value for name—is passed as the second argument. In other words, the order in which the first two arguments are passed is reversed.

This part of the Flask API was unaffected by the upgrade from Flask 1.x.x to 2.x.x, but Flask 2.x.x will raise the following exception when it notices that the HireFire blueprint's name contains a dot (.):

Screen Shot 2021-06-01 at 3 13 55 PM

In this PR, I switch the order of the first two arguments to the Blueprint constructor.

@codecov
Copy link

codecov bot commented Jun 1, 2021

Codecov Report

Merging #62 (2c71876) into main (665217e) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #62   +/-   ##
=======================================
  Coverage   55.55%   55.55%           
=======================================
  Files          11       11           
  Lines         423      423           
=======================================
  Hits          235      235           
  Misses        188      188           
Impacted Files Coverage Δ
hirefire/contrib/flask/blueprint.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 665217e...2c71876. Read the comment docs.

Copy link

@djsavvy djsavvy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, great catch!

@ryanhiebert
Copy link
Owner

Cool, thank you!

@ryanhiebert ryanhiebert merged commit 2d14d02 into ryanhiebert:main Jun 3, 2021
@owenniles owenniles deleted the fix-blueprint-name branch June 3, 2021 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants