Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ff3b72

Browse files
committed
Fix caching logic on logged in users
1 parent 119c1c9 commit 6ff3b72

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

ckan/lib/base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
import ckan.lib.helpers as h
2121
import ckan.plugins as p
2222

23-
from ckan.common import request, config, session
24-
23+
from ckan.common import request, config, session, g
2524

2625
log = logging.getLogger(__name__)
2726

@@ -116,7 +115,7 @@ def _allow_caching(cache_force: Optional[bool] = None):
116115
if cache_force is not None:
117116
allow_cache = cache_force
118117
# Do not allow caching of pages for logged in users/flash messages etc.
119-
elif _is_valid_session_cookie_data():
118+
elif ('user' in g and g.user) or _is_valid_session_cookie_data():
120119
allow_cache = False
121120
# Tests etc.
122121
elif 'REMOTE_USER' in request.environ:

0 commit comments

Comments
 (0)