Skip to content

Commit 360229b

Browse files
committed
Removed script URL types in favor of str
1 parent e531103 commit 360229b

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

debug_toolbar/panels/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import typing as t
22

33
from fastapi import Request, Response
4-
from starlette.datastructures import URL
54
from starlette.middleware.base import RequestResponseEndpoint
65

76
from debug_toolbar.types import ServerTiming, Stats
@@ -67,11 +66,11 @@ def content(self) -> str:
6766
def render(self, **context: t.Any) -> str:
6867
return self.toolbar.render(self.template, **context)
6968

70-
def url_for(self, name: str, **path_params: t.Any) -> URL:
71-
return self.toolbar.request.url_for(name, **path_params)
69+
def url_for(self, name: str, **path_params: t.Any) -> str:
70+
return str(self.toolbar.request.url_for(name, **path_params))
7271

7372
@property
74-
def scripts(self) -> t.List[URL]:
73+
def scripts(self) -> t.List[str]:
7574
return []
7675

7776
async def process_request(self, request: Request) -> Response:

debug_toolbar/panels/timer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from time import perf_counter
33

44
from fastapi import Request, Response
5-
from starlette.datastructures import URL
65

76
from debug_toolbar.panels import Panel
87
from debug_toolbar.types import ServerTiming, Stats
@@ -46,7 +45,7 @@ def content(self) -> str:
4645
return self.render(rows=rows)
4746

4847
@property
49-
def scripts(self) -> t.List[URL]:
48+
def scripts(self) -> t.List[str]:
5049
scripts = super().scripts
5150
scripts.append(self.url_for("debug_toolbar.static", path="js/timer.js"))
5251
return scripts

debug_toolbar/panels/versions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import typing as t
22

33
from fastapi import Request, Response, __version__
4-
from starlette.datastructures import URL
54

65
from debug_toolbar.panels import Panel
76
from debug_toolbar.types import Stats
@@ -16,7 +15,7 @@ def nav_subtitle(self) -> str:
1615
return f"FastAPI {__version__}"
1716

1817
@property
19-
def scripts(self) -> t.List[URL]:
18+
def scripts(self) -> t.List[str]:
2019
scripts = super().scripts
2120
scripts.append(self.url_for("debug_toolbar.static", path="js/versions.js"))
2221
return scripts

0 commit comments

Comments
 (0)