Rename wikidata_oauth to mediawiki_oauth

This commit is contained in:
Edward Betts 2023-12-06 11:29:03 +00:00
parent 128d84fce9
commit ea95c82b37
2 changed files with 4 additions and 4 deletions

View file

@ -11,7 +11,7 @@ import werkzeug
from requests_oauthlib import OAuth1Session
from werkzeug.wrappers.response import Response
from add_links import api, core, mediawiki_api, wikidata_oauth
from add_links import api, core, mediawiki_api, mediawiki_oauth
from add_links.match import NoMatch, get_diff, get_match
app = flask.Flask(__name__)
@ -83,7 +83,7 @@ def search_no_link(q: str) -> tuple[int, list[Hit]]:
@app.before_request
def global_user() -> None:
"""Make username available everywhere."""
flask.g.user = wikidata_oauth.get_username()
flask.g.user = mediawiki_oauth.get_username()
@app.route("/")
@ -268,7 +268,7 @@ def article_page(url_title: str) -> str | Response:
hit_title = flask.request.form["hit"]
try:
do_save(from_title, hit_title)
except wikidata_oauth.LoginNeeded:
except mediawiki_oauth.LoginNeeded:
return flask.redirect(flask.url_for("start_oauth"))
return flask.redirect(
flask.url_for("article_page", url_title=url_title, after=hit_title)
@ -316,7 +316,7 @@ def article_page(url_title: str) -> str | Response:
def do_save(title: str, hit_title: str) -> str:
"""Update page on Wikipedia."""
token = wikidata_oauth.get_token()
token = mediawiki_oauth.get_token()
found = get_match(title, hit_title, None)