Skip to content

Commit

Permalink
eliminate '_request_ctx_stack' is deprecated message moinwiki#1486
Browse files Browse the repository at this point in the history
Must also fix flask_theme
  • Loading branch information
RogerHaase committed Aug 24, 2023
1 parent 551cdb6 commit 4ddd769
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/moin/i18n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
from babel import Locale
from contextlib import contextmanager

from flask import current_app, request, _request_ctx_stack
from flask import current_app, request
from flask import g as flaskg
from flask_babel import Babel, gettext, ngettext, lazy_gettext
from flask.globals import request_ctx

from moin import log
logging = log.getLogger(__name__)
Expand Down Expand Up @@ -90,7 +91,7 @@ def force_locale(locale):
with force_locale('en_US'):
send_email(gettext('Hello!'), ...)
"""
ctx = _request_ctx_stack.top
ctx = request_ctx
if ctx is None:
yield
return
Expand Down

0 comments on commit 4ddd769

Please sign in to comment.