File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
tests/integrations/django/myapp Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -310,7 +310,9 @@ def safe_repr(value):
310310def object_to_json (obj ):
311311 def _walk (obj , depth ):
312312 if depth < 4 :
313- if isinstance (obj , Sequence ) and not isinstance (obj , (bytes , text_type )):
313+ if isinstance (obj , (list , tuple )):
314+ # It is not safe to iterate over another sequence types as this may raise errors or
315+ # bring undesired side-effects (e.g. Django querysets are executed during iteration)
314316 return [_walk (x , depth + 1 ) for x in obj ]
315317 if isinstance (obj , Mapping ):
316318 return {safe_str (k ): _walk (v , depth + 1 ) for k , v in obj .items ()}
Original file line number Diff line number Diff line change 11from django .contrib .auth import login
22from django .contrib .auth .models import User
33from django .http import HttpResponse , HttpResponseServerError , HttpResponseNotFound
4- from django .shortcuts import render_to_response
4+ from django .shortcuts import render
55from django .views .generic import ListView
66
77import sentry_sdk
@@ -45,5 +45,5 @@ def handler404(*args, **kwargs):
4545 return HttpResponseNotFound ("404" )
4646
4747
48- def template_exc (* args , ** kwargs ):
49- return render_to_response ( "error.html" )
48+ def template_exc (request , * args , ** kwargs ):
49+ return render ( request , "error.html" )
You can’t perform that action at this time.
0 commit comments