Skip to content

Commit d22a079

Browse files
committed
Fix Python test failure.
1 parent b1fe14f commit d22a079

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

web/pgadmin/utils/session.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def put(self, session):
102102
'Store a managed session'
103103
raise NotImplementedError
104104

105+
105106
class CachingSessionManager(SessionManager):
106107
def __init__(self, parent, num_to_store, skip_paths=None):
107108
self.parent = parent
@@ -120,10 +121,10 @@ def is_session_ready(self, _session):
120121
if not has_request_context():
121122
return False
122123

123-
# ._get_current_object() returns the actual dict-like object
124+
# Session _id returns the str object
124125
# or None if it hasn't been set yet.
125126
try:
126-
return _session._get_current_object() is not None
127+
return _session['_id'] is not None
127128
except (AssertionError, RuntimeError):
128129
return False
129130

@@ -155,10 +156,11 @@ def exists(self, sid):
155156

156157
def get(self, sid, digest):
157158
session = None
158-
with sess_lock:
159+
with (sess_lock):
159160
if sid in self._cache:
160161
session = self._cache[sid]
161-
if self.is_session_ready(session) and session.hmac_digest != digest:
162+
if self.is_session_ready(session) and\
163+
session.hmac_digest != digest:
162164
session = None
163165

164166
# reset order in Dict

0 commit comments

Comments
 (0)