Skip to content

Commit 3db9949

Browse files
committed
feat(django): Use @wraps in more places
1 parent 889aec4 commit 3db9949

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sentry_sdk/integrations/django/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import functools
12
import inspect
23
import sys
34
import threading
@@ -168,6 +169,7 @@ def setup_once():
168169
old_app = WSGIHandler.__call__
169170

170171
@ensure_integration_enabled(DjangoIntegration, old_app)
172+
@functools.wraps(old_app)
171173
def sentry_patched_wsgi_handler(self, environ, start_response):
172174
# type: (Any, Dict[str, str], Callable[..., Any]) -> _ScopedResponse
173175
bound_old_app = old_app.__get__(self, WSGIHandler)
@@ -321,6 +323,7 @@ def _patch_drf():
321323
else:
322324
old_drf_initial = APIView.initial
323325

326+
@functools.wraps(old_drf_initial)
324327
def sentry_patched_drf_initial(self, request, *args, **kwargs):
325328
# type: (APIView, Any, *Any, **Any) -> Any
326329
with capture_internal_exceptions():
@@ -471,6 +474,7 @@ def _patch_get_response():
471474

472475
old_get_response = BaseHandler.get_response
473476

477+
@functools.wraps(old_get_response)
474478
def sentry_patched_get_response(self, request):
475479
# type: (Any, WSGIRequest) -> Union[HttpResponse, BaseException]
476480
_before_get_response(request)
@@ -637,6 +641,7 @@ def install_sql_hook():
637641
return
638642

639643
@ensure_integration_enabled(DjangoIntegration, real_execute)
644+
@functools.wraps(real_execute)
640645
def execute(self, sql, params=None):
641646
# type: (CursorWrapper, Any, Optional[Any]) -> Any
642647
with record_sql_queries(
@@ -656,6 +661,7 @@ def execute(self, sql, params=None):
656661
return result
657662

658663
@ensure_integration_enabled(DjangoIntegration, real_executemany)
664+
@functools.wraps(real_executemany)
659665
def executemany(self, sql, param_list):
660666
# type: (CursorWrapper, Any, List[Any]) -> Any
661667
with record_sql_queries(
@@ -676,6 +682,7 @@ def executemany(self, sql, param_list):
676682
return result
677683

678684
@ensure_integration_enabled(DjangoIntegration, real_connect)
685+
@functools.wraps(real_connect)
679686
def connect(self):
680687
# type: (BaseDatabaseWrapper) -> None
681688
with capture_internal_exceptions():

0 commit comments

Comments
 (0)