Load the data from the key itself instead of fetching from some external data store. Opposite of _get_session_key(), raise BadSignature if signature fails.
(self)
| 4 | |
| 5 | class SessionStore(SessionBase): |
| 6 | def load(self): |
| 7 | """ |
| 8 | Load the data from the key itself instead of fetching from some |
| 9 | external data store. Opposite of _get_session_key(), raise BadSignature |
| 10 | if signature fails. |
| 11 | """ |
| 12 | try: |
| 13 | return signing.loads( |
| 14 | self.session_key, |
| 15 | serializer=self.serializer, |
| 16 | # This doesn't handle non-default expiry dates, see #19201 |
| 17 | max_age=self.get_session_cookie_age(), |
| 18 | salt="django.contrib.sessions.backends.signed_cookies", |
| 19 | ) |
| 20 | except Exception: |
| 21 | # BadSignature, ValueError, or unpickling exceptions. If any of |
| 22 | # these happen, reset the session. |
| 23 | self.create() |
| 24 | return {} |
| 25 | |
| 26 | async def aload(self): |
| 27 | return self.load() |
no test coverage detected