From 182bf53c4d033bb696ff164ed7b224ed96d5d782 Mon Sep 17 00:00:00 2001 From: Lex Date: Thu, 18 Apr 2024 16:55:58 +1000 Subject: [PATCH] Align serializer methods --- CONTRIBUTORS.md | 1 + src/flask_session/postgresql/postgresql.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 62186cc4..a49a86b8 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,5 +1,6 @@ ## Contributors +- [giuppep](https://github.com/giuppep) - [eiriklid](https://github.com/eiriklid) - [necat1](https://github.com/necat1) - [nebolax](https://github.com/nebolax) diff --git a/src/flask_session/postgresql/postgresql.py b/src/flask_session/postgresql/postgresql.py index 9ad198bb..9094e001 100644 --- a/src/flask_session/postgresql/postgresql.py +++ b/src/flask_session/postgresql/postgresql.py @@ -117,7 +117,7 @@ def _retrieve_session_data(self, store_id: str) -> Optional[dict]: if session_data is not None: serialized_session_data = want_bytes(session_data[0]) - return self.serializer.decode(serialized_session_data) + return self.serializer.loads(serialized_session_data) return None @retry_query(max_attempts=3) @@ -125,7 +125,7 @@ def _upsert_session( self, session_lifetime: TimeDelta, session: ServerSideSession, store_id: str ) -> None: - serialized_session_data = self.serializer.encode(session) + serialized_session_data = self.serializer.dumps(session) if session.sid is not None: assert session.sid == store_id.removeprefix(self.key_prefix)