Skip to content

Commit 5320db8

Browse files
restore wsgi.py
1 parent bea8782 commit 5320db8

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

sentry_sdk/integrations/wsgi.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import sys
2-
import functools
32
from functools import partial
43
from typing import TYPE_CHECKING
54

@@ -71,7 +70,6 @@ class SentryWsgiMiddleware:
7170
"use_x_forwarded_for",
7271
"span_origin",
7372
"http_methods_to_capture",
74-
"_wsgi_file_wrapper",
7573
)
7674

7775
def __init__(
@@ -87,19 +85,11 @@ def __init__(
8785
self.http_methods_to_capture = http_methods_to_capture
8886

8987
def __call__(
90-
self, environ: "Dict[str, Any]", start_response: "Callable[..., Any]"
88+
self, environ: "Dict[str, str]", start_response: "Callable[..., Any]"
9189
) -> "_ScopedResponse":
9290
if _wsgi_middleware_applied.get(False):
9391
return self.app(environ, start_response)
9492

95-
old_wsgi_file_wrapper = environ["wsgi.file_wrapper"]
96-
97-
def _patch_environ_wsgi_file_wrapper(fileobj, block_size=8192):
98-
self._wsgi_file_wrapper = old_wsgi_file_wrapper(fileobj, block_size)
99-
return self._wsgi_file_wrapper
100-
101-
environ["wsgi.file_wrapper"] = _patch_environ_wsgi_file_wrapper
102-
10393
_wsgi_middleware_applied.set(True)
10494
try:
10595
with sentry_sdk.isolation_scope() as scope:
@@ -145,9 +135,6 @@ def _patch_environ_wsgi_file_wrapper(fileobj, block_size=8192):
145135
finally:
146136
_wsgi_middleware_applied.set(False)
147137

148-
if response is self._wsgi_file_wrapper:
149-
return response
150-
151138
return _ScopedResponse(scope, response)
152139

153140

@@ -228,14 +215,6 @@ def _capture_exception() -> "ExcInfo":
228215
return exc_info
229216

230217

231-
class _ScopedFileWrapper:
232-
def __init__(self, scope: "sentry_sdk.scope.Scope", fileno):
233-
pass
234-
235-
def fileno():
236-
pass
237-
238-
239218
class _ScopedResponse:
240219
"""
241220
Users a separate scope for each response chunk.

0 commit comments

Comments
 (0)