Skip to content

Commit edba3c7

Browse files
committed
Add references
1 parent edf28c3 commit edba3c7

File tree

13 files changed

+49
-61
lines changed

13 files changed

+49
-61
lines changed

esmerald/conf/global_settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ def openapi_config(self) -> OpenAPIConfig:
971971
@property
972972
def middleware(self) -> Sequence[Middleware]:
973973
"""
974-
A global sequence of Starlette middlewares or `esmerald.middlewares` that are
974+
A global sequence of Lilya middlewares or `esmerald.middlewares` that are
975975
used by the application.
976976
977977
Read more about the [Middleware](https://esmerald.dev/middleware/middleware/).

esmerald/middleware/authentication.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class BaseAuthMiddleware(ABC, MiddlewareProtocol): # pragma: no cover
2929
3030
It is not mandatory to use it and you are free to implement your.
3131
32-
Esmerald being based on Starlette, also offers a simple but powerful
32+
Esmerald being based on Lilya, also offers a simple but powerful
3333
interface for handling `authentication` and [permissions](https://esmerald.dev/permissions/).
3434
3535
Once you have installed the `AuthenticationMiddleware` and implemented the

esmerald/middleware/exceptions.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Any, Callable, Dict, List, Mapping, Optional, Type, Union, cast
33

44
from lilya import status
5-
from lilya.exceptions import HTTPException as StarletteHTTPException
5+
from lilya.exceptions import HTTPException as LilyaException
66
from lilya.middleware.exceptions import ExceptionMiddleware as LilyaExceptionMiddleware
77
from lilya.responses import Response as LilyaResponse
88
from lilya.types import ASGIApp, Receive, Scope, Send
@@ -35,7 +35,7 @@ def __init__(
3535
self._status_handlers: Dict[int, Callable] = {}
3636
self._exception_handlers: Dict[Type[Exception], Callable] = {
3737
HTTPException: http_exception_handler,
38-
StarletteHTTPException: http_exception_handler,
38+
LilyaException: http_exception_handler,
3939
WebSocketException: self.websocket_exception,
4040
}
4141
if handlers is not None:
@@ -99,7 +99,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
9999
if isinstance(ex, WebSocketException):
100100
code = ex.code
101101
reason = ex.detail
102-
elif isinstance(ex, StarletteHTTPException):
102+
elif isinstance(ex, LilyaException):
103103
code = ex.status_code + 4000
104104
reason = ex.detail
105105
else:
@@ -113,7 +113,7 @@ def default_http_exception_handler(self, request: Request, exc: Exception) -> "L
113113
"""Default handler for exceptions subclassed from HTTPException."""
114114
status_code = (
115115
exc.status_code
116-
if isinstance(exc, StarletteHTTPException)
116+
if isinstance(exc, LilyaException)
117117
else status.HTTP_500_INTERNAL_SERVER_ERROR
118118
)
119119
if status_code == status.HTTP_500_INTERNAL_SERVER_ERROR and self.debug:
@@ -122,7 +122,7 @@ def default_http_exception_handler(self, request: Request, exc: Exception) -> "L
122122
return self.create_exception_response(exc)
123123

124124
def create_exception_response(self, exc: Exception) -> Response:
125-
if isinstance(exc, (HTTPException, StarletteHTTPException)):
125+
if isinstance(exc, (HTTPException, LilyaException)):
126126
content = ResponseContent(detail=exc.detail, status_code=exc.status_code)
127127
if isinstance(exc, HTTPException):
128128
extra = exc.extra.get("extra", {})
@@ -134,9 +134,7 @@ def create_exception_response(self, exc: Exception) -> Response:
134134
media_type=MediaType.JSON,
135135
content=content.model_dump(exclude_none=True),
136136
status_code=content.status_code,
137-
headers=(
138-
exc.headers if isinstance(exc, (HTTPException, StarletteHTTPException)) else None
139-
),
137+
headers=(exc.headers if isinstance(exc, (HTTPException, LilyaException)) else None),
140138
)
141139

142140
def get_exception_handler(

esmerald/permissions/base.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def is_user_authenticated(self, request: "Request") -> bool:
212212
This method must be overridden by subclasses.
213213
214214
Args:
215-
request: A Starlette 'Connection' instance.
215+
request: A Lilya 'Connection' instance.
216216
217217
Returns:
218218
bool: True or False
@@ -225,7 +225,7 @@ def is_user_staff(self, request: "Request") -> bool:
225225
This method must be overridden by subclasses.
226226
227227
Args:
228-
request: A Starlette 'Connection' instance.
228+
request: A Lilya 'Connection' instance.
229229
230230
Returns:
231231
bool: True or False
@@ -278,7 +278,7 @@ def has_permission(
278278
) -> bool:
279279
"""
280280
Args:
281-
request: A Starlette 'Connection' instance.
281+
request: A Lilya 'Connection' instance.
282282
apiview: A Esmerald 'APIController' instance or a `APIGateHandler` instance.
283283
284284
Returns:
@@ -300,7 +300,7 @@ def has_permission(
300300
) -> bool:
301301
"""
302302
Args:
303-
request: A Starlette 'Connection' instance.
303+
request: A Lilya 'Connection' instance.
304304
apiview: A Esmerald 'APIController' instance or a `APIGateHandler` instance.
305305
306306
Returns:
@@ -322,7 +322,7 @@ def has_permission(
322322
) -> bool:
323323
"""
324324
Args:
325-
request: A Starlette 'Connection' instance.
325+
request: A Lilya 'Connection' instance.
326326
apiview: A Esmerald 'APIController' instance or a `APIGateHandler` instance.
327327
328328
Returns:

esmerald/routing/apis/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class CustomView(View):
112112
Optional[List["Middleware"]],
113113
Doc(
114114
"""
115-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
115+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
116116
"""
117117
),
118118
]

esmerald/routing/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class PathParameterSchema(TypedDict):
9090
class OpenAPIDefinitionMixin: # pragma: no cover
9191
def parse_path(self, path: str) -> List[Union[str, PathParameterSchema]]:
9292
"""
93-
Using the Starlette CONVERTORS and the application registered convertors,
93+
Using the Lilya TRANSFORMERS and the application registered convertors,
9494
transforms the path into a PathParameterSchema used for the OpenAPI definition.
9595
"""
9696
_, path, variables, _ = compile_path(path)
@@ -241,7 +241,7 @@ def starlette_response_handler(
241241
cookies: "ResponseCookies",
242242
headers: Optional["ResponseHeaders"] = None,
243243
) -> "AsyncAnyCallable":
244-
"""Creates an handler for Starlette Responses."""
244+
"""Creates an handler for Lilya Responses."""
245245

246246
async def response_content(data: LilyaResponse, **kwargs: Dict[str, Any]) -> LilyaResponse:
247247
_cookies = self.get_cookies(cookies, [])

esmerald/routing/events.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ class AyncLifespanContextManager: # pragma: no cover
1515
Manages and handles the on_startup and on_shutdown events
1616
in an Esmerald way.
1717
18-
This is not the same as the on_startup and on_shutdown
19-
from Starlette. Those are now deprecated and will be removed
20-
in the version 1.0 of Starlette.
21-
2218
This aims to provide a similar functionality but by generating
2319
a lifespan event based on the values from the on_startup and on_shutdown
2420
lists.
@@ -57,7 +53,7 @@ def handle_lifespan_events(
5753
on_shutdown: Optional[Sequence["LifeSpanHandler"]] = None,
5854
lifespan: Optional[Lifespan[Any]] = None,
5955
) -> Any: # pragma: no cover
60-
"""Handles with the lifespan events in the new Starlette format of lifespan.
56+
"""Handles with the lifespan events in the new Lilya format of lifespan.
6157
This adds a mask that keeps the old `on_startup` and `on_shutdown` events variable
6258
declaration for legacy and comprehension purposes and build the async context manager
6359
for the lifespan.

esmerald/routing/gateways.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def __init__(
152152
Optional[List["Middleware"]],
153153
Doc(
154154
"""
155-
A list of middleware to run for every request. The middlewares of a Gateway will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
155+
A list of middleware to run for every request. The middlewares of a Gateway will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
156156
"""
157157
),
158158
] = None,
@@ -263,7 +263,7 @@ def __init__(
263263
)
264264
"""
265265
A "bridge" to a handler and router mapping functionality.
266-
Since the default Starlette Route handler does not understand the Esmerald handlers,
266+
Since the default Lilya Route handler does not understand the Esmerald handlers,
267267
the Gateway bridges both functionalities and adds an extra "flair" to be compliant with both class based views and decorated function views.
268268
"""
269269
self._interceptors: Union[List["Interceptor"], "VoidType"] = Void
@@ -415,7 +415,7 @@ def __init__(
415415
Optional[List["Middleware"]],
416416
Doc(
417417
"""
418-
A list of middleware to run for every request. The middlewares of a Gateway will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
418+
A list of middleware to run for every request. The middlewares of a Gateway will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
419419
"""
420420
),
421421
] = None,
@@ -485,7 +485,7 @@ def __init__(
485485
)
486486
"""
487487
A "bridge" to a handler and router mapping functionality.
488-
Since the default Starlette Route handler does not understand the Esmerald handlers,
488+
Since the default Lilya Route handler does not understand the Esmerald handlers,
489489
the Gateway bridges both functionalities and adds an extra "flair" to be compliant with both class based views and decorated function views.
490490
"""
491491
self._interceptors: Union[List["Interceptor"], "VoidType"] = Void

esmerald/routing/handlers.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ async def get_joiners() -> None:
159159
Optional[List["Middleware"]],
160160
Doc(
161161
"""
162-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
162+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
163163
"""
164164
),
165165
] = None,
@@ -529,7 +529,7 @@ def head(
529529
Optional[List["Middleware"]],
530530
Doc(
531531
"""
532-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
532+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
533533
"""
534534
),
535535
] = None,
@@ -836,7 +836,7 @@ async def create_joiners() -> None:
836836
Optional[List["Middleware"]],
837837
Doc(
838838
"""
839-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
839+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
840840
"""
841841
),
842842
] = None,
@@ -1239,7 +1239,7 @@ async def update_joiners() -> None:
12391239
Optional[List["Middleware"]],
12401240
Doc(
12411241
"""
1242-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
1242+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
12431243
"""
12441244
),
12451245
] = None,
@@ -1642,7 +1642,7 @@ async def update_partial_joiners() -> None:
16421642
Optional[List["Middleware"]],
16431643
Doc(
16441644
"""
1645-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
1645+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
16461646
"""
16471647
),
16481648
] = None,
@@ -2045,7 +2045,7 @@ async def delete_joiners() -> None:
20452045
Optional[List["Middleware"]],
20462046
Doc(
20472047
"""
2048-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
2048+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
20492049
"""
20502050
),
20512051
] = None,
@@ -2415,7 +2415,7 @@ def options(
24152415
Optional[List["Middleware"]],
24162416
Doc(
24172417
"""
2418-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
2418+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
24192419
"""
24202420
),
24212421
] = None,
@@ -2684,7 +2684,7 @@ def trace(
26842684
Optional[List["Middleware"]],
26852685
Doc(
26862686
"""
2687-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
2687+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
26882688
"""
26892689
),
26902690
] = None,
@@ -3006,7 +3006,7 @@ async def operate_joiners() -> None:
30063006
Optional[List["Middleware"]],
30073007
Doc(
30083008
"""
3009-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
3009+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
30103010
"""
30113011
),
30123012
] = None,
@@ -3336,7 +3336,7 @@ def websocket(
33363336
Optional[List["Middleware"]],
33373337
Doc(
33383338
"""
3339-
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Starlette Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
3339+
A list of middleware to run for every request. The middlewares of an Include will be checked from top-down or [Lilya Middleware](https://www.lilya.dev/middleware/) as they are both converted internally. Read more about [Python Protocols](https://peps.python.org/pep-0544/).
33403340
"""
33413341
),
33423342
] = None,

0 commit comments

Comments
 (0)