File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121def show_toolbar (request : Request , settings : DebugToolbarSettings ) -> bool :
2222 if settings .ALLOWED_IPS is not None :
23- remote_addr , _ = request . scope ["client" ]
23+ remote_addr , _ = request ["client" ]
2424 return request .app .debug and remote_addr in settings .ALLOWED_IPS
2525 return request .app .debug
2626
@@ -63,7 +63,7 @@ async def dispatch(
6363 request .scope ["route" ] = matched_route (request )
6464
6565 if (
66- not request . scope ["route" ]
66+ not request ["route" ]
6767 or not self .show_toolbar (request , self .settings )
6868 or self .settings .API_URL in request .url .path
6969 ):
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ def nav_subtitle(self) -> str:
9292 return f"{ record_count } message{ pluralize (record_count )} "
9393
9494 async def process_request (self , request : Request ) -> Response :
95- if is_coroutine (request . scope ["route" ].endpoint ):
95+ if is_coroutine (request ["route" ].endpoint ):
9696 self .thread_id = threading .get_ident ()
9797 else :
9898 self .thread_id = await run_in_threadpool (threading .get_ident )
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class ProfilingPanel(Panel):
1515
1616 async def process_request (self , request : Request ) -> Response :
1717 self .profiler = Profiler (** self .toolbar .settings .PROFILER_OPTIONS )
18- is_async = is_coroutine (request . scope ["route" ].endpoint )
18+ is_async = is_coroutine (request ["route" ].endpoint )
1919
2020 async def call (func : t .Callable ) -> None :
2121 await run_in_threadpool (func ) if not is_async else func ()
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ def nav_subtitle(self) -> str:
1616 return get_name_from_obj (self .endpoint )
1717
1818 async def generate_stats (self , request : Request , response : Response ) -> Stats :
19- self .endpoint = request . scope ["endpoint" ]
19+ self .endpoint = request ["endpoint" ]
2020 stats : t .Dict [str , t .Any ] = {"request" : request }
2121
2222 if hasattr (self , "_form" ):
Original file line number Diff line number Diff line change @@ -11,5 +11,5 @@ class RoutesPanel(Panel):
1111 async def generate_stats (self , request : Request , response : Response ) -> Stats :
1212 return {
1313 "routes" : request .app .routes ,
14- "endpoint" : request . scope ["endpoint" ],
14+ "endpoint" : request ["endpoint" ],
1515 }
Original file line number Diff line number Diff line change @@ -56,10 +56,10 @@ def after_execute(
5656 self .add_query (str (conn .engine .url ), query )
5757
5858 async def add_engines (self , request : Request ):
59- route = request . scope ["route" ]
59+ route = request ["route" ]
6060
6161 if hasattr (route , "dependant" ):
62- if request . scope . get ( "fastapi_astack" ) is None :
62+ if "fastapi_astack" not in request :
6363 async with AsyncExitStack () as stack :
6464 request .scope ["fastapi_astack" ] = stack
6565
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ <h4>Endpoint information</h4>
99 </ thead >
1010 < tbody >
1111 < tr >
12- < td > {{ get_name_from_obj(request.scope. endpoint) }}</ td >
12+ < td > {{ get_name_from_obj(request.endpoint) }}</ td >
1313 < td >
1414 {% if request.path_params %}
1515 {% for k, v in request.path_params.items() %}
You can’t perform that action at this time.
0 commit comments