Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
- Dropped support for Starlette below 0.20.
- Dropped support for FastAPI below 0.85.
- Dropped support for trytond below 5.4.
- Dropped support for Pyramid below 2.0.
- Dropped support for rq below 1.0.
- Dropped support for Quart below 0.19.
- Dropped support for Sanic below 22.0.
Expand Down
4 changes: 2 additions & 2 deletions scripts/populate_tox/package_dependencies.jsonl

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions scripts/populate_tox/releases.jsonl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sentry_sdk/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def iter_default_integrations(
"openfeature": (0, 7, 1),
"pydantic_ai": (1, 0, 0),
"pymongo": (3, 5, 0),
"pyramid": (1, 8),
"pyramid": (2, 0),
"pyreqwest": (0, 11, 6),
"quart": (0, 19, 0),
"ray": (2, 7, 0),
Expand Down
20 changes: 5 additions & 15 deletions sentry_sdk/integrations/pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import Any, Callable, Dict, Optional
from typing import Any, Callable, Dict

from pyramid.response import Response
from webob.cookies import RequestCookies
Expand All @@ -40,16 +40,6 @@
from sentry_sdk.utils import ExcInfo


if getattr(Request, "authenticated_userid", None):

def authenticated_userid(request: "Request") -> "Optional[Any]":
return request.authenticated_userid

else:
# bw-compat for pyramid < 1.5
from pyramid.security import authenticated_userid # type: ignore


TRANSACTION_STYLE_VALUES = ("route_name", "route_pattern")


Expand Down Expand Up @@ -94,11 +84,11 @@ def sentry_patched_call_view(
if has_span_streaming_enabled(client.options):
if has_data_collection_enabled(client.options):
if client.options["data_collection"]["user_info"]:
user_id = authenticated_userid(request)
user_id = request.authenticated_userid
if user_id:
scope.set_user({"id": user_id})
elif should_send_default_pii():
user_id = authenticated_userid(request)
user_id = request.authenticated_userid
if user_id:
scope.set_user({"id": user_id})

Expand Down Expand Up @@ -245,11 +235,11 @@ def pyramid_event_processor(event: "Event", hint: "Dict[str, Any]") -> "Event":
if client_options["data_collection"]["user_info"]:
with capture_internal_exceptions():
user_info = event.setdefault("user", {})
user_info.setdefault("id", authenticated_userid(request))
user_info.setdefault("id", request.authenticated_userid)
elif should_send_default_pii():
with capture_internal_exceptions():
user_info = event.setdefault("user", {})
user_info.setdefault("id", authenticated_userid(request))
user_info.setdefault("id", request.authenticated_userid)

return event

Expand Down
54 changes: 27 additions & 27 deletions tox.ini

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading