File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
src/opentelemetry/attributes Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 2020
2121from opentelemetry .util import types
2222
23+ WSGIRequest = None # type: ignore
24+ _HAS_DJANGO = False
2325if TYPE_CHECKING :
2426 try :
2527 from django .core .handlers .wsgi import WSGIRequest
2628 _HAS_DJANGO = True
2729 except ImportError :
28- WSGIRequest = None # type: ignore
29- _HAS_DJANGO = False
30- else :
31- _HAS_DJANGO = False
30+ pass
3231
3332# bytes are accepted as a user supplied value for attributes but
3433# decoded to strings internally.
Original file line number Diff line number Diff line change 1818import unittest
1919from typing import TYPE_CHECKING , MutableSequence
2020
21+ _HAS_DJANGO = False
22+ WSGIRequest = None
23+ settings = None
2124if TYPE_CHECKING :
2225 try :
2326 from django .conf import settings
2427 from django .core .handlers .wsgi import WSGIRequest
2528 _HAS_DJANGO = True
2629 except ImportError :
27- WSGIRequest = None # type: ignore
28- settings = None # type: ignore
29- _HAS_DJANGO = False
30- else :
31- _HAS_DJANGO = False
30+ pass
3231
3332from opentelemetry .attributes import (
3433 BoundedAttributes ,
@@ -197,7 +196,7 @@ def test_mapping(self):
197196
198197 def test_wsgi_request_attribute (self ):
199198 if _HAS_DJANGO and WSGIRequest is not None :
200- if not settings .configured :
199+ if settings and not settings .configured :
201200 settings .configure (
202201 DEBUG = True ,
203202 SECRET_KEY = "test-secret-key" ,
You can’t perform that action at this time.
0 commit comments