Skip to content

Commit

Permalink
Hide type error on one line
Browse files Browse the repository at this point in the history
> app.py:573: error: "AppContext" has no attribute "setdefault"

This is a workaround for a type bug introduced in Flask 2.0.0 (already
fixed in pallets/flask#4042 [1], but 2.0.1 not yet released).

[1]: pallets/flask#4042
  • Loading branch information
lucaswerkmeister committed May 15, 2021
1 parent 530f750 commit 9aa4d57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def edit_token(session: mwapi.Session) -> str:
Not to be confused with csrf_token,
which gets a token for use within the tool."""

edit_tokens = flask.g.setdefault('edit_tokens', {})
edit_tokens = flask.g.setdefault('edit_tokens', {}) # type: ignore
key = session.host
if key in edit_tokens:
return edit_tokens[key]
Expand Down

0 comments on commit 9aa4d57

Please sign in to comment.