# HG changeset patch # User RhodeCode Admin # Date 2023-01-31 07:54:26 # Node ID 2ecd5d81436b87096d8789d5947166e9b6444234 # Parent deeb4059e8b1104f08d3475f1ed87758003e6c3c error-reporting: fix setting call_context on dummy-request available in sentry diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -460,7 +460,12 @@ def attach_context_attributes(context, r context.rhodecode_user = request.rpc_user # attach the whole call context to the request - request.call_context = context + # use set_call_context method if request has it + # sometimes in Celery context requests is "different" + if hasattr(request, 'set_call_context'): + request.set_call_context(context) + else: + request.call_context = context def get_auth_user(request): @@ -616,6 +621,9 @@ def bootstrap_request(**kwargs): def call_context(self): return self._call_context + def set_call_context(self, new_context): + self._call_context = new_context + class TestDummySession(pyramid.testing.DummySession): def save(*arg, **kw): pass