fastlifeweb 0.7.0__py3-none-any.whl → 0.7.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ from typing import (
22
22
  )
23
23
 
24
24
  import venusian # type: ignore
25
- from fastapi import Depends, FastAPI, Response
25
+ from fastapi import Depends, FastAPI, Request, Response
26
26
  from fastapi.params import Depends as DependsType
27
27
  from fastapi.staticfiles import StaticFiles
28
28
 
@@ -31,6 +31,7 @@ from fastlife.configurator.route_handler import FastlifeRoute
31
31
  from fastlife.security.csrf import check_csrf
32
32
 
33
33
  from .settings import Settings
34
+ from .route_handler import FastlifeRequest
34
35
 
35
36
  if TYPE_CHECKING:
36
37
  from .registry import AppRegistry # coverage: ignore
@@ -193,7 +194,12 @@ class Configurator:
193
194
  self, status_code_or_exc: int | Type[Exception], handler: Any
194
195
  ) -> "Configurator":
195
196
  """Add an exception handler the application."""
196
- self._app.add_exception_handler(status_code_or_exc, handler)
197
+
198
+ def exception_handler(request: Request, exc: Exception) -> Any:
199
+ req = FastlifeRequest(self.registry, request)
200
+ return handler(req, exc)
201
+
202
+ self._app.add_exception_handler(status_code_or_exc, exception_handler)
197
203
  return self
198
204
 
199
205
 
@@ -3,15 +3,14 @@ from typing import TYPE_CHECKING, Any, Callable, Coroutine
3
3
  from fastapi import Request as BaseRequest
4
4
  from fastapi.routing import APIRoute
5
5
  from starlette.responses import Response
6
- from starlette.types import Receive, Scope
7
6
 
8
7
  if TYPE_CHECKING:
9
8
  from .registry import AppRegistry # coverage: ignore
10
9
 
11
10
 
12
11
  class FastlifeRequest(BaseRequest):
13
- def __init__(self, registry: "AppRegistry", scope: Scope, receive: Receive) -> None:
14
- super().__init__(scope, receive)
12
+ def __init__(self, registry: "AppRegistry", request: BaseRequest) -> None:
13
+ super().__init__(request.scope, request.receive)
15
14
  self.registry = registry
16
15
 
17
16
 
@@ -24,7 +23,7 @@ class FastlifeRoute(APIRoute):
24
23
  orig_route_handler = super().get_route_handler()
25
24
 
26
25
  async def route_handler(request: BaseRequest) -> FastlifeRequest:
27
- req = FastlifeRequest(self.registry, request.scope, request.receive)
26
+ req = FastlifeRequest(self.registry, request)
28
27
  return await orig_route_handler(req) # type: ignore
29
28
 
30
29
  return route_handler # type: ignore
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastlifeweb
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: High-level web framework
5
5
  Home-page: https://github.com/mardiros/fastlife
6
6
  License: BSD-derived
@@ -1,9 +1,9 @@
1
1
  fastlife/__init__.py,sha256=nAeweHnTvWHgDZYuPIWawZvT4juuhvMp4hzF2B-yCJU,317
2
2
  fastlife/configurator/__init__.py,sha256=vMV25HEfuXjCL7DhZukhlB2JSfxwzX2lGbErcZ5b7N0,146
3
3
  fastlife/configurator/base.py,sha256=2ahvTudLmD99YQjnIeGN5JDPCSl3k-mauu7bsSEB5RE,216
4
- fastlife/configurator/configurator.py,sha256=yy7etOLqgm7KfybJMz0fFYwDSsbv81daV3W9wBugswA,7003
4
+ fastlife/configurator/configurator.py,sha256=3VnwA-ES9KumYc_XOJZq7O--qHeRceUldH66RaIy3bQ,7234
5
5
  fastlife/configurator/registry.py,sha256=FKXCxWlMMGNN1-l5H6QLTCoqP_tWENN84RjkConejWI,1580
6
- fastlife/configurator/route_handler.py,sha256=kFi-fPzt2t3NFZLtj-rY0219iSCpPzj4daeQ65wUcYU,1037
6
+ fastlife/configurator/route_handler.py,sha256=TRsiGM8xQxJvRFbdKZphLK7l37DSfKvvmkEbg-h5EoU,977
7
7
  fastlife/configurator/settings.py,sha256=uyIZFLqzbwDAUkl8LWNYdlPifMR3ZItyC4y9ci_3LrM,3376
8
8
  fastlife/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  fastlife/request/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -70,7 +70,7 @@ fastlife/testing/__init__.py,sha256=vuqwoNUd3BuIp3fm7nkvmYkIGjIimf5zUGhDkeWrg2s,
70
70
  fastlife/testing/testclient.py,sha256=wJtWXxn5cew8PlxweYvw7occnoD5Ktr_7IxEXi-Ieg0,20534
71
71
  fastlife/views/__init__.py,sha256=nn4B_8YTbTmhGPvSd20yyKK_9Dh1Pfh_Iq7z6iK8-CE,154
72
72
  fastlife/views/pydantic_form.py,sha256=KJtH_DK8em0czGPsv0XpzGUFhtycyXdeRldwiU7d_j4,1257
73
- fastlifeweb-0.7.0.dist-info/LICENSE,sha256=F75xSseSKMwqzFj8rswYU6NWS3VoWOc_gY3fJYf9_LI,1504
74
- fastlifeweb-0.7.0.dist-info/METADATA,sha256=Of-0L69qHEgTqacKnSKduuEYiqho2RkH7OHjHUDgVKo,1833
75
- fastlifeweb-0.7.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
76
- fastlifeweb-0.7.0.dist-info/RECORD,,
73
+ fastlifeweb-0.7.1.dist-info/LICENSE,sha256=F75xSseSKMwqzFj8rswYU6NWS3VoWOc_gY3fJYf9_LI,1504
74
+ fastlifeweb-0.7.1.dist-info/METADATA,sha256=-dGK9zmf4PUfvKmBZmF5zCIbyJb_QmmgFI70rvOoDrk,1833
75
+ fastlifeweb-0.7.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
76
+ fastlifeweb-0.7.1.dist-info/RECORD,,