MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / new_session

Method new_session

web/pgadmin/utils/session.py:305–325  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

303 os.unlink(fname)
304
305 def new_session(self):
306 sid = str(uuid4())
307 fname = safe_join(self.path, sid)
308
309 while fname is not None and os.path.exists(fname):
310 sid = str(uuid4())
311 fname = safe_join(self.path, sid)
312
313 # Do not store the session if skip paths
314 for sp in self.skip_paths:
315 if request.path.startswith(sp):
316 return ManagedSession(sid=sid)
317
318 if fname is None:
319 raise InternalServerError('Failed to create new session')
320
321 # touch the file with mode 0o600 — see _open_session_file rationale.
322 with _open_session_file(fname):
323 return ManagedSession(sid=sid)
324
325 return ManagedSession(sid=sid)
326
327 def get(self, sid, digest):
328 """Retrieve a managed session by session-id, verifying integrity

Callers 1

getMethod · 0.95

Calls 3

ManagedSessionClass · 0.85
_open_session_fileFunction · 0.85
existsMethod · 0.45

Tested by

no test coverage detected