MCPcopy Index your code
hub / github.com/webpy/webpy / _load

Method _load

web/session.py:99–125  ·  view source on GitHub ↗

Load the session from the store, by the id from cookie

(self)

Source from the content-addressed store, hash-verified

97 self._save()
98
99 def _load(self):
100 """Load the session from the store, by the id from cookie"""
101 cookie_name = self._config.cookie_name
102 self.session_id = web.cookies().get(cookie_name)
103 # Handler can do session.send_cookie = False to not send the cookie
104 self.send_cookie = True
105
106 # protection against session_id tampering
107 if self.session_id and not self._valid_session_id(self.session_id):
108 self.session_id = None
109
110 self._check_expiry()
111 if self.session_id:
112 d = self.store[self.session_id]
113 self.update(d)
114 self._validate_ip()
115
116 if not self.session_id:
117 self.session_id = self._generate_session_id()
118
119 if self._initializer:
120 if isinstance(self._initializer, dict):
121 self.update(deepcopy(self._initializer))
122 elif hasattr(self._initializer, "__call__"):
123 self._initializer()
124
125 self.ip = web.ctx.ip
126
127 def _check_expiry(self):
128 # check for expiry

Callers 1

_processorMethod · 0.95

Calls 6

_valid_session_idMethod · 0.95
_check_expiryMethod · 0.95
_validate_ipMethod · 0.95
_generate_session_idMethod · 0.95
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected