Skip to content

Commit

Permalink
chore: use function instead of direct context check
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Dec 8, 2023
1 parent 6ad50c3 commit 4b45b13
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
from markdown import markdown
from bleach import clean as bleach_clean, ALLOWED_TAGS, ALLOWED_ATTRIBUTES
from ckan.common import asbool, config, current_user
from flask import flash
from flask import flash, has_request_context
from flask import get_flashed_messages as _flask_get_flashed_messages
from flask import redirect as _flask_redirect
from flask.globals import request_ctx
from flask import url_for as _flask_default_url_for
from werkzeug.routing import BuildError as FlaskRouteBuildError
from ckan.lib import i18n
Expand Down Expand Up @@ -311,7 +310,7 @@ def _get_auto_flask_context():
from ckan.config.middleware import _internal_test_request_context

# This is a normal web request, there is a request context present
if request_ctx:
if has_request_context():
return None

# We are outside a web request. A test web application was created
Expand Down

0 comments on commit 4b45b13

Please sign in to comment.