Skip to content

Commit a5052b0

Browse files
authored
fix: pass capture_exceptions as keyword arg in Django middleware (#488)
1 parent 95df295 commit a5052b0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
pypi/posthog: patch
3+
---
4+
5+
fix: Django middleware accidentally passed capture_exceptions as positional arg, setting fresh=True and resetting context state

posthog/integrations/django.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ def __call__(self, request):
265265
if self.request_filter and not self.request_filter(request):
266266
return self.get_response(request)
267267

268-
with contexts.new_context(self.capture_exceptions, client=self.client):
268+
with contexts.new_context(
269+
capture_exceptions=self.capture_exceptions, client=self.client
270+
):
269271
for k, v in self.extract_tags(request).items():
270272
contexts.tag(k, v)
271273

@@ -283,7 +285,9 @@ async def __acall__(self, request):
283285
if self.request_filter and not self.request_filter(request):
284286
return await self.get_response(request)
285287

286-
with contexts.new_context(self.capture_exceptions, client=self.client):
288+
with contexts.new_context(
289+
capture_exceptions=self.capture_exceptions, client=self.client
290+
):
287291
for k, v in (await self.aextract_tags(request)).items():
288292
contexts.tag(k, v)
289293

0 commit comments

Comments
 (0)