def load(self):
session_data = {}<EOL>try:<EOL><INDENT>session_data = decode(self.session_key,<EOL>settings.DJAODJIN_SECRET_KEY)<EOL>self._session_key_data.update(session_data)<EOL>LOGGER.debug("<STR_LIT>", session_data)<EOL>if '<STR_LIT:username>' in session_data:<EOL><INDENT>user = authenticate(<EOL>request=session_data, remote_user=session_data['<STR_LIT:username>'])<EOL>if not user:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>session_data[SESSION_KEY] = user.id<EOL>session_data[BACKEND_SESSION_KEY] = user.backend<EOL>session_data[HASH_SESSION_KEY] = user.get_session_auth_hash()<EOL>if self._local:<EOL><INDENT>session_data_local = self._local.load()<EOL>LOGGER.debug("<STR_LIT>", session_data_local)<EOL>session_data.update(session_data_local)<EOL><DEDENT><DEDENT><DEDENT>except Exception as err: <EOL><INDENT>LOGGER.debug("<STR_LIT>", err)<EOL>return {}<EOL><DEDENT>return session_data<EOL>
We load the data from the key itself instead of fetching from
some external data store. Opposite of _get_session_key(),
raises BadSignature if signature fails.