Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Enable session_redis to work with Sentry #474

Open
wants to merge 1 commit into
base: 18.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion session_redis/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ def purge_fs_sessions(path):
host,
port,
)
http.Application.session_store = session_store
target = http.Application
if not hasattr(target, "session_store"):
# Some other module (at least OCA/server-tools/sentry) has replaced
# Application with a different object, hopefully wrapping it instead of
# completely overwriting it
# Try and see if we can extract the proper object from http.root instead
if not hasattr(http.root, "session_store"):
raise Exception(
"session_redis: unable to find correct objects to patch for "
"session management. Has another module overwritten "
"odoo.http.Application with a different object?"
)
else:
_logger.warning(
"Extracting underlying web app object from odoo.http.root, as "
"the actual Application object has been replaced. This may not "
"work correctly: if you can affect load order, try to make "
"session_redis load before other server-wide modules."
)
target = type(http.root)
target.session_store = session_store
# clean the existing sessions on the file system
purge_fs_sessions(config.session_dir)