MCPcopy
hub / github.com/django/django / _get_session

Method _get_session

django/contrib/sessions/backends/base.py:242–255  ·  view source on GitHub ↗

Lazily load session from storage (unless "no_load" is True, when only an empty dict is stored) and store it in the current instance.

(self, no_load=False)

Source from the content-addressed store, hash-verified

240 _session_key = property(_get_session_key, _set_session_key)
241
242 def _get_session(self, no_load=False):
243 """
244 Lazily load session from storage (unless "no_load" is True, when only
245 an empty dict is stored) and store it in the current instance.
246 """
247 self.accessed = True
248 try:
249 return self._session_cache
250 except AttributeError:
251 if self.session_key is None or no_load:
252 self._session_cache = {}
253 else:
254 self._session_cache = self.load()
255 return self._session_cache
256
257 async def _aget_session(self, no_load=False):
258 self.accessed = True

Callers 3

saveMethod · 0.80
saveMethod · 0.80
saveMethod · 0.80

Calls 1

loadMethod · 0.95

Tested by

no test coverage detected