Skip to content

Commit

Permalink
Remove null session interface, fix incorrect runtime error
Browse files Browse the repository at this point in the history
Previously failure to set session type resulted in error message that says a secret key is required
  • Loading branch information
Lxstr committed Feb 2, 2024
1 parent 5381243 commit d7ed1c6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
3 changes: 1 addition & 2 deletions src/flask_session/__init__.py
Expand Up @@ -3,7 +3,6 @@
FileSystemSessionInterface,
MemcachedSessionInterface,
MongoDBSessionInterface,
NullSessionInterface,
RedisSessionInterface,
SqlAlchemySessionInterface,
)
Expand Down Expand Up @@ -150,6 +149,6 @@ def _get_interface(self, app):
bind_key=SESSION_SQLALCHEMY_BIND_KEY,
)
else:
session_interface = NullSessionInterface()
raise RuntimeError(f"Unrecognized value for SESSION_TYPE: {SESSION_TYPE}")

return session_interface
12 changes: 0 additions & 12 deletions src/flask_session/sessions.py
Expand Up @@ -79,18 +79,6 @@ def _sign(self, app, sid):
return signer.sign(sid_as_bytes).decode("utf-8")


class NullSessionInterface(SessionInterface):
"""Used to open a :class:`flask.sessions.NullSession` instance.
If you do not configure a different ``SESSION_TYPE``, this will be used to
generate nicer error messages. Will allow read-only access to the empty
session but fail on setting.
"""

def open_session(self, app, request):
return None


class ServerSideSessionInterface(SessionInterface, ABC):
"""Used to open a :class:`flask.sessions.ServerSideSessionInterface` instance."""

Expand Down

0 comments on commit d7ed1c6

Please sign in to comment.