fastlifeweb 0.22.0__py3-none-any.whl → 0.22.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.
- CHANGELOG.md +3 -0
- fastlife/__init__.py +11 -2
- fastlife/adapters/fastapi/request.py +4 -4
- fastlife/adapters/fastapi/routing/route.py +1 -1
- fastlife/config/configurator.py +1 -1
- fastlife/domain/model/request.py +3 -2
- fastlife/service/locale_negociator.py +2 -2
- fastlife/service/security_policy.py +2 -2
- {fastlifeweb-0.22.0.dist-info → fastlifeweb-0.22.1.dist-info}/METADATA +1 -1
- {fastlifeweb-0.22.0.dist-info → fastlifeweb-0.22.1.dist-info}/RECORD +13 -13
- {fastlifeweb-0.22.0.dist-info → fastlifeweb-0.22.1.dist-info}/WHEEL +0 -0
- {fastlifeweb-0.22.0.dist-info → fastlifeweb-0.22.1.dist-info}/entry_points.txt +0 -0
- {fastlifeweb-0.22.0.dist-info → fastlifeweb-0.22.1.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md
CHANGED
fastlife/__init__.py
CHANGED
@@ -7,7 +7,13 @@ from fastapi.responses import RedirectResponse
|
|
7
7
|
|
8
8
|
from .adapters.fastapi.form import form_model
|
9
9
|
from .adapters.fastapi.localizer import Localizer
|
10
|
-
from .adapters.fastapi.request import
|
10
|
+
from .adapters.fastapi.request import (
|
11
|
+
AnyRequest,
|
12
|
+
Registry,
|
13
|
+
Request,
|
14
|
+
get_registry,
|
15
|
+
get_request,
|
16
|
+
)
|
11
17
|
from .config import (
|
12
18
|
Configurator,
|
13
19
|
GenericConfigurator,
|
@@ -30,7 +36,7 @@ from .domain.model.security_policy import (
|
|
30
36
|
from .domain.model.template import JinjaXTemplate
|
31
37
|
|
32
38
|
# from .request.form_data import model
|
33
|
-
from .service.registry import DefaultRegistry, GenericRegistry
|
39
|
+
from .service.registry import DefaultRegistry, GenericRegistry, TRegistry, TSettings
|
34
40
|
from .service.security_policy import AbstractSecurityPolicy, InsecurePolicy
|
35
41
|
from .settings import Settings
|
36
42
|
|
@@ -47,6 +53,9 @@ __all__ = [
|
|
47
53
|
"resource_view",
|
48
54
|
"Configurator",
|
49
55
|
"DefaultRegistry",
|
56
|
+
"TSettings",
|
57
|
+
"TRegistry",
|
58
|
+
"get_registry",
|
50
59
|
# Form
|
51
60
|
"FormModel",
|
52
61
|
"form_model",
|
@@ -9,18 +9,18 @@ from fastlife.domain.model.request import GenericRequest
|
|
9
9
|
from fastlife.service.registry import DefaultRegistry
|
10
10
|
|
11
11
|
|
12
|
-
def get_request(request: FastAPIRequest) -> GenericRequest[Any]:
|
12
|
+
def get_request(request: FastAPIRequest) -> GenericRequest[Any, Any]:
|
13
13
|
"""Return the Fastlife Request object."""
|
14
14
|
return request # type: ignore
|
15
15
|
|
16
16
|
|
17
|
-
Request = Annotated[GenericRequest[DefaultRegistry], Depends(get_request)]
|
17
|
+
Request = Annotated[GenericRequest[Any, DefaultRegistry], Depends(get_request)]
|
18
18
|
"""A request that is associated to the default registry."""
|
19
19
|
# FastAPI handle its Request objects using a lenient_issubclass,
|
20
|
-
# basically a issubclass(Request),
|
20
|
+
# basically a issubclass(Request), does not work with Generic[T].
|
21
21
|
|
22
22
|
|
23
|
-
AnyRequest = Annotated[GenericRequest[Any], Depends(get_request)]
|
23
|
+
AnyRequest = Annotated[GenericRequest[Any, Any], Depends(get_request)]
|
24
24
|
"""A request version that is associated to the any registry."""
|
25
25
|
|
26
26
|
|
@@ -41,7 +41,7 @@ class Route(APIRoute):
|
|
41
41
|
orig_route_handler = super().get_route_handler()
|
42
42
|
|
43
43
|
async def route_handler(request: StarletteRequest) -> Response:
|
44
|
-
req = GenericRequest(self._registry, request)
|
44
|
+
req = GenericRequest[Any, Any](self._registry, request)
|
45
45
|
return await orig_route_handler(req)
|
46
46
|
|
47
47
|
return route_handler
|
fastlife/config/configurator.py
CHANGED
@@ -594,7 +594,7 @@ class GenericConfigurator(Generic[TRegistry]):
|
|
594
594
|
# class is wrong.
|
595
595
|
# Until we store a security policy per rooter, we rebuild an
|
596
596
|
# incomplete request here.
|
597
|
-
req = GenericRequest[DefaultRegistry](self.registry, request)
|
597
|
+
req = GenericRequest[Any, DefaultRegistry](self.registry, request)
|
598
598
|
resp = handler(req, exc)
|
599
599
|
if isinstance(resp, Response):
|
600
600
|
return resp
|
fastlife/domain/model/request.py
CHANGED
@@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, Any, Generic
|
|
5
5
|
from starlette.requests import Request as BaseRequest
|
6
6
|
|
7
7
|
from fastlife.domain.model.csrf import CSRFToken, create_csrf_token
|
8
|
+
from fastlife.domain.model.security_policy import TUser
|
8
9
|
from fastlife.service.registry import TRegistry
|
9
10
|
|
10
11
|
if TYPE_CHECKING:
|
@@ -14,7 +15,7 @@ if TYPE_CHECKING:
|
|
14
15
|
)
|
15
16
|
|
16
17
|
|
17
|
-
class GenericRequest(BaseRequest, Generic[TRegistry]):
|
18
|
+
class GenericRequest(BaseRequest, Generic[TUser, TRegistry]):
|
18
19
|
"""HTTP Request representation."""
|
19
20
|
|
20
21
|
registry: TRegistry
|
@@ -22,7 +23,7 @@ class GenericRequest(BaseRequest, Generic[TRegistry]):
|
|
22
23
|
locale_name: str
|
23
24
|
"""Request locale used for the i18n of the response."""
|
24
25
|
|
25
|
-
security_policy: "AbstractSecurityPolicy[
|
26
|
+
security_policy: "AbstractSecurityPolicy[TUser, TRegistry] | None"
|
26
27
|
"""Request locale used for the i18n of the response."""
|
27
28
|
|
28
29
|
renderer_globals: dict[str, Any]
|
@@ -10,14 +10,14 @@ LocaleName = str
|
|
10
10
|
|
11
11
|
from fastlife.adapters.fastapi.request import GenericRequest # coverage: ignore
|
12
12
|
|
13
|
-
LocaleNegociator = Callable[[GenericRequest[Any]], LocaleName] # coverage: ignore
|
13
|
+
LocaleNegociator = Callable[[GenericRequest[Any, Any]], LocaleName] # coverage: ignore
|
14
14
|
"""Interface to implement to negociate a locale""" # coverage: ignore
|
15
15
|
|
16
16
|
|
17
17
|
def default_negociator(settings: Settings) -> LocaleNegociator:
|
18
18
|
"""The default local negociator return the locale set in the conf."""
|
19
19
|
|
20
|
-
def locale_negociator(request: "GenericRequest[Any]") -> str:
|
20
|
+
def locale_negociator(request: "GenericRequest[Any, Any]") -> str:
|
21
21
|
return settings.default_locale
|
22
22
|
|
23
23
|
return locale_negociator
|
@@ -25,11 +25,11 @@ class AbstractSecurityPolicy(abc.ABC, Generic[TUser, TRegistry]):
|
|
25
25
|
Unauthorized = Unauthorized
|
26
26
|
"""The exception raised if no user has been identified."""
|
27
27
|
|
28
|
-
request: GenericRequest[TRegistry]
|
28
|
+
request: GenericRequest[TUser, TRegistry]
|
29
29
|
"""Request where the security policy is applied."""
|
30
30
|
|
31
31
|
def __init__(
|
32
|
-
self, request: Annotated[GenericRequest[TRegistry], Depends(get_request)]
|
32
|
+
self, request: Annotated[GenericRequest[TUser, TRegistry], Depends(get_request)]
|
33
33
|
):
|
34
34
|
"""
|
35
35
|
Build the security policy.
|
@@ -1,13 +1,13 @@
|
|
1
|
-
CHANGELOG.md,sha256=
|
2
|
-
fastlife/__init__.py,sha256=
|
1
|
+
CHANGELOG.md,sha256=iMVndHirSKsb0IAqVoiHUmMU4uYt7fwML0j96qwPYUc,7049
|
2
|
+
fastlife/__init__.py,sha256=cPPHF7zBVBkUt6KsJyVNiamuRRjUeERQsPVoS6AB-YE,1779
|
3
3
|
fastlife/adapters/__init__.py,sha256=imPD1hImpgrYkvUJRhHA5kVyGAua7VbP2WGkhSWKJT8,93
|
4
4
|
fastlife/adapters/fastapi/__init__.py,sha256=1goV1FGFP04TGyskJBLKZam4Gvt1yoAvLMNs4ekWSSQ,243
|
5
5
|
fastlife/adapters/fastapi/form.py,sha256=csxsDI6RK-g41pMwFhaVQCLDhF7dAZzgUp-VcrC3NFY,823
|
6
6
|
fastlife/adapters/fastapi/form_data.py,sha256=2DQ0o-RvY6iROUKQjS-UJdNYEVSsNPd-AjpergI3w54,4473
|
7
7
|
fastlife/adapters/fastapi/localizer.py,sha256=XD1kCJuAlkGevivmvAJEcGMCBWMef9rAfTOGmt3PVWU,436
|
8
|
-
fastlife/adapters/fastapi/request.py,sha256=
|
8
|
+
fastlife/adapters/fastapi/request.py,sha256=hvJS7qxH7ZyKRdwDalVXGU8ZH84NtSQuljnAZPyqogU,1100
|
9
9
|
fastlife/adapters/fastapi/routing/__init__.py,sha256=8EMnQE5n8oA4J9_c3nxzwKDVt3tefZ6fGH0d2owE8mo,195
|
10
|
-
fastlife/adapters/fastapi/routing/route.py,sha256=
|
10
|
+
fastlife/adapters/fastapi/routing/route.py,sha256=Y4LTTTgQAR5zPMV3hKBP-YYjEQC41UUIa5ZuPCPf2aY,1471
|
11
11
|
fastlife/adapters/fastapi/routing/router.py,sha256=jzrnU_Lyywu21e3spPaWQw8ujZh_Yy_EJOojcCi6ew4,499
|
12
12
|
fastlife/adapters/itsdangerous/__init__.py,sha256=7ocGY7v0cxooZBKQYjA2JkmzRqiBvcU1uzA84UsTVAI,84
|
13
13
|
fastlife/adapters/itsdangerous/session.py,sha256=9h_WRsXqZbytHZOv5B_K3OWD5mbfYzxHulXoOf6D2MI,1685
|
@@ -1686,7 +1686,7 @@ fastlife/components/pydantic_form/FatalError.jinja,sha256=lFVlNrXzBR6ExMahq77h0t
|
|
1686
1686
|
fastlife/components/pydantic_form/Hint.jinja,sha256=8leBpfMGDmalc_KAjr2paTojr_rwq-luS6m_1BGj7Tw,202
|
1687
1687
|
fastlife/components/pydantic_form/Widget.jinja,sha256=PgguUpvhG6CY9AW6H8qQMjKqjlybjDCAaFFAOHzrzVQ,418
|
1688
1688
|
fastlife/config/__init__.py,sha256=5qpuaVYqi-AS0GgsfggM6rFsSwXgrqrLBo9jH6dVroc,407
|
1689
|
-
fastlife/config/configurator.py,sha256=
|
1689
|
+
fastlife/config/configurator.py,sha256=AC4s4iM_DPDkKDs7DP6GJFwMt-HFqFtAHUcBnr1BGkY,24707
|
1690
1690
|
fastlife/config/exceptions.py,sha256=9MdBnbfy-Aw-KaIFzju0Kh8Snk41-v9LqK2w48Tdy1s,1169
|
1691
1691
|
fastlife/config/openapiextra.py,sha256=rYoerrn9sni2XwnO3gIWqaz7M0aDZPhVLjzqhDxue0o,514
|
1692
1692
|
fastlife/config/resources.py,sha256=u6OgnbHfGkC5idH-YPNkIPf8GJnZpJoGVZ-Ym022BCo,8533
|
@@ -1696,7 +1696,7 @@ fastlife/domain/model/__init__.py,sha256=aoBjaSpDscuFXvtknJHwiNyoJRUpE-v4X54h_wN
|
|
1696
1696
|
fastlife/domain/model/asgi.py,sha256=RSTnfTsofOmCaWzHNuRGowjlyHYmoDCrXFbvNY_B55k,129
|
1697
1697
|
fastlife/domain/model/csrf.py,sha256=BUiWK-S7rVciWHO1qTkM8e_KxzpF6gGC4MMJK1v6iDo,414
|
1698
1698
|
fastlife/domain/model/form.py,sha256=WriBT1qUUIbf5x5iewo9ChEcr6k0en8jMTD0iaei5Pk,3253
|
1699
|
-
fastlife/domain/model/request.py,sha256=
|
1699
|
+
fastlife/domain/model/request.py,sha256=hMbp1OWY1BIWmqFe-kEvwOOXBB6t1ylVaHR30UbQ0_Y,2596
|
1700
1700
|
fastlife/domain/model/security_policy.py,sha256=iYBKXOYaXxM_n-rsyB25lO6RblSx9icTx1Bg-s3Iz9k,2942
|
1701
1701
|
fastlife/domain/model/template.py,sha256=z9oxdKme1hMPuvk7mBiKR_tuVY8TqH77aTYqMgvEGl8,876
|
1702
1702
|
fastlife/domain/model/types.py,sha256=64jJKFAi5x0e3vr8naHU1m_as0Qy8MS-s9CG0z6K1qc,381
|
@@ -1711,9 +1711,9 @@ fastlife/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1711
1711
|
fastlife/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1712
1712
|
fastlife/service/check_permission.py,sha256=-XD9qA11dLwen0bNCTy2Id_dCjzTJ0j7xuwB9IOtEY0,1695
|
1713
1713
|
fastlife/service/csrf.py,sha256=wC1PaKOmZ3il0FF_kevxnlg9PxDqruRdLrNnOA3ZHrU,1886
|
1714
|
-
fastlife/service/locale_negociator.py,sha256=
|
1714
|
+
fastlife/service/locale_negociator.py,sha256=Dq0k7lvUWOmd0o2xJFneymOu-H9z-RpSYU_AZ2IYF-g,780
|
1715
1715
|
fastlife/service/registry.py,sha256=B6n5b_b0RgxJj0qFOpnrJFmG7_MPtvShwV6yH9V6vi0,2098
|
1716
|
-
fastlife/service/security_policy.py,sha256=
|
1716
|
+
fastlife/service/security_policy.py,sha256=fOyhaLNI3EzW5p_s3ZcrDaf7cX-KEWb7fQANoQSk6yg,3050
|
1717
1717
|
fastlife/service/templates.py,sha256=QPAIUbbZiekazz_jV3q4JCwQd6Q4KA6a4RDek2RWuhE,2548
|
1718
1718
|
fastlife/service/translations.py,sha256=D-1D3pVNytEcps1u-0K7FmgQ8Wo6Yu4XVHvZrPhBmAI,5795
|
1719
1719
|
fastlife/settings.py,sha256=q-rz4CEF2RQGow5-m-yZJOvdh3PPb2c1Q_ZLJGnu4VQ,3647
|
@@ -1728,9 +1728,9 @@ fastlife/testing/session.py,sha256=LEFFbiR67_x_g-ioudkY0C7PycHdbDfaIaoo_G7GXQ8,2
|
|
1728
1728
|
fastlife/testing/testclient.py,sha256=JTIgeMKooA8L4gEodeC3gy4Lo27y3WNswSEIKLlVVPs,6745
|
1729
1729
|
fastlife/views/__init__.py,sha256=zG8gveL8e2zBdYx6_9jtZfpQ6qJT-MFnBY3xXkLwHZI,22
|
1730
1730
|
fastlife/views/pydantic_form.py,sha256=o7EUItciAGL1OSaGNHo-3BTrYAk34GuWE7zGikjiAGY,1486
|
1731
|
-
fastlifeweb-0.22.
|
1732
|
-
fastlifeweb-0.22.
|
1733
|
-
fastlifeweb-0.22.
|
1734
|
-
fastlifeweb-0.22.
|
1731
|
+
fastlifeweb-0.22.1.dist-info/METADATA,sha256=UO41tIM5bFp2QZF-GO1aXFa-k6FN85JShOEsFUsCuZA,3663
|
1732
|
+
fastlifeweb-0.22.1.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
1733
|
+
fastlifeweb-0.22.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
1734
|
+
fastlifeweb-0.22.1.dist-info/licenses/LICENSE,sha256=NlRX9Z-dcv8X1VFW9odlIQBbgNN9pcO94XzvKp2R16o,1075
|
1735
1735
|
tailwind.config.js,sha256=EN3EahBDmQBbmJvkw3SdGWNOkfkzw0cg-QvBikOhkrw,1348
|
1736
|
-
fastlifeweb-0.22.
|
1736
|
+
fastlifeweb-0.22.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|