fastlifeweb 0.16.0__py3-none-any.whl → 0.16.2__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.
@@ -62,7 +62,7 @@ def generate_docstring(
62
62
  docstring = (ast.get_docstring(func_def, clean=True) or "").strip()
63
63
  if docstring:
64
64
  docstring = textwrap.dedent(docstring)
65
- docstring_lines = [l for l in docstring.split("\n")]
65
+ docstring_lines = [line for line in docstring.split("\n")]
66
66
  # Add a newline for separation after the function docstring
67
67
  docstring_lines.append("")
68
68
  else:
@@ -145,6 +145,7 @@ class GenericConfigurator(Generic[TRegistry]):
145
145
  str, "type[AbstractSecurityPolicy[Any, TRegistry]]"
146
146
  ] = {}
147
147
 
148
+ self._registered_permissions: set[str] = set()
148
149
  self.scanner = venusian.Scanner(fastlife=self)
149
150
  self.include("fastlife.views")
150
151
  self.include("fastlife.middlewares")
@@ -153,6 +154,15 @@ class GenericConfigurator(Generic[TRegistry]):
153
154
  def _current_router(self) -> Router:
154
155
  return self._routers[self._route_prefix]
155
156
 
157
+ @property
158
+ def all_registered_permissions(self) -> Sequence[str]:
159
+ """
160
+ Get the list of registered permissions.
161
+
162
+ This is usefull for introspection or testing purpose.
163
+ """
164
+ return sorted(self._registered_permissions)
165
+
156
166
  def build_asgi_app(self) -> FastAPI:
157
167
  """
158
168
  Build the app after configuration in order to start after beeing configured.
@@ -404,6 +414,7 @@ class GenericConfigurator(Generic[TRegistry]):
404
414
  """
405
415
  dependencies: list[DependsType] = []
406
416
  if permission:
417
+ self._registered_permissions.add(permission)
407
418
  dependencies.append(Depends(check_permission(permission)))
408
419
 
409
420
  self._current_router.add_api_route(
@@ -465,6 +476,7 @@ class GenericConfigurator(Generic[TRegistry]):
465
476
  """
466
477
  dependencies: list[DependsType] = []
467
478
  if permission:
479
+ self._registered_permissions.add(permission)
468
480
  dependencies.append(Depends(check_permission(permission)))
469
481
 
470
482
  if template:
@@ -1,10 +1,9 @@
1
1
  """HTTP Request representation in a python object."""
2
2
 
3
- from typing import TYPE_CHECKING, Any
3
+ from typing import TYPE_CHECKING, Annotated, Any, Generic
4
4
 
5
5
  from fastapi import Request as FastAPIRequest
6
6
  from fastapi.params import Depends
7
- from typing_extensions import Annotated, Generic
8
7
 
9
8
  from fastlife.config.registry import DefaultRegistry, TRegistry
10
9
 
@@ -2,16 +2,14 @@
2
2
 
3
3
  import abc
4
4
  import logging
5
- from typing import Annotated, Any, Callable, Coroutine, Literal, TypeVar
5
+ from typing import Annotated, Any, Callable, Coroutine, Generic, Literal, TypeVar
6
6
  from uuid import UUID
7
7
 
8
8
  from fastapi import Depends, HTTPException
9
9
  from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
10
- from typing_extensions import Generic
11
10
 
12
- from fastlife import get_request
11
+ from fastlife import GenericRequest, get_request
13
12
  from fastlife.config.registry import TRegistry
14
- from tests.fastlife_app.config import GenericRequest
15
13
 
16
14
  CheckPermissionHook = Callable[..., Coroutine[Any, Any, None]] | Callable[..., None]
17
15
  CheckPermission = Callable[[str], CheckPermissionHook]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastlifeweb
3
- Version: 0.16.0
3
+ Version: 0.16.2
4
4
  Summary: High-level web framework
5
5
  Home-page: https://github.com/mardiros/fastlife
6
6
  License: BSD-derived
@@ -1,7 +1,7 @@
1
1
  fastlife/__init__.py,sha256=fokakuhI0fdAjHP5w6GWi-YfCx7iTnrVzjSyZ11Cdgg,676
2
2
  fastlife/adapters/__init__.py,sha256=WYjEN8gp4r7LCHqmIO5VzzvsT8QGRE3w4G47UwYDtAo,94
3
3
  fastlife/adapters/jinjax/__init__.py,sha256=jy88zyqk7nFlaY-0lmgAoe0HyO5r_NKckQb3faQiUv4,137
4
- fastlife/adapters/jinjax/renderer.py,sha256=tKX_C0fGnooMcMXBz4_8Ym2VLCKEkRk9_AXq6HrN11I,13040
4
+ fastlife/adapters/jinjax/renderer.py,sha256=rj2KI4GB8tZstJwImdDYHuswxjdbGri2f8H6YuByaLo,13046
5
5
  fastlife/adapters/jinjax/widgets/__init__.py,sha256=HERnX9xiXUbTDz3XtlnHWABTBjhIq_kkBgWs5E6ZIMY,42
6
6
  fastlife/adapters/jinjax/widgets/base.py,sha256=JoB1bLI97ZW2ycfBcHgrPxiOszE9t_SFFK5L1bR-cSo,4015
7
7
  fastlife/adapters/jinjax/widgets/boolean.py,sha256=w4hZMo_8xDoThStlIUR4eVfLm8JwUp0-TaGCjGSyCbA,1145
@@ -1666,7 +1666,7 @@ fastlife/components/pydantic_form/Textarea.jinja,sha256=NzfCi5agRUSVcb5RXw0QamM8
1666
1666
  fastlife/components/pydantic_form/Union.jinja,sha256=czTska54z9KCZKu-FaycLmOvtH6y6CGUFQ8DHnkjrJk,1461
1667
1667
  fastlife/components/pydantic_form/Widget.jinja,sha256=EXskDqt22D5grpGVwlZA3ndve2Wr_6yQH4qVE9c31Og,397
1668
1668
  fastlife/config/__init__.py,sha256=ThosRIPZ_fpD0exZu-kUC_f8ZNa5KyDlleWMmEHkjEo,448
1669
- fastlife/config/configurator.py,sha256=5In_ciAxqORR47gKIbZKTd1IOkkMO0a0iB4q5x7ltaI,21955
1669
+ fastlife/config/configurator.py,sha256=-U-se932t95YiIfPD6N-CElWuuqbKP2AKTjJXoajCKE,22385
1670
1670
  fastlife/config/exceptions.py,sha256=2MS2MFgb3mDbtdHEwnC-QYubob3Rl0v8O8y615LY0ds,1180
1671
1671
  fastlife/config/openapiextra.py,sha256=_9rBYeTqB7nVuzvUHMwZU387bTfYFHYLlP05NP0vEDs,513
1672
1672
  fastlife/config/registry.py,sha256=dGcNm7E6WY0x5HZNzo1gBFvGFCWeJj6JFXsJtLax5NU,1347
@@ -1685,13 +1685,13 @@ fastlife/request/__init__.py,sha256=-wrh12uWM7ysmIUE6FszBit2H6iI5LWVEnHxQJ_23ZE,
1685
1685
  fastlife/request/form.py,sha256=Ln9TySvAccYhFY9zc49P6YGE9cQSi_o3mByxvcuCIKY,3516
1686
1686
  fastlife/request/form_data.py,sha256=DNKpXUxeDMYb43zSBnSPTBjAB8OhsYlNjERSsLgFdvI,4454
1687
1687
  fastlife/request/localizer.py,sha256=9MXAcsod-Po5qeg4lttD3dyumiI0y5vGHCwSSmt9or8,349
1688
- fastlife/request/request.py,sha256=bJydiRLkhRaA2Y5OCYN6p1rIlhSRsRicCFNVeM-RdgI,2597
1688
+ fastlife/request/request.py,sha256=h4Ji0GElWJ3W2hHgOwjSKHQcxUjjPuOk09v-oyfjEd0,2568
1689
1689
  fastlife/routing/__init__.py,sha256=8EMnQE5n8oA4J9_c3nxzwKDVt3tefZ6fGH0d2owE8mo,195
1690
1690
  fastlife/routing/route.py,sha256=O0gwPtP7ur2EHRf76kBASgoLMQciGHXcrJkW8zEPFJA,1413
1691
1691
  fastlife/routing/router.py,sha256=bLZ4k2aDs4L423znwGnw-X2LnM36O8fjhDWc8q1WewI,481
1692
1692
  fastlife/security/__init__.py,sha256=QYDcJ3oXQzqXQxoDD_6biGAtercFrtePttoifiL1j34,25
1693
1693
  fastlife/security/csrf.py,sha256=PvC9Fqdb6c0IzzsnaMx2quQdjjKrb-nOPoAHfcwoAe8,2141
1694
- fastlife/security/policy.py,sha256=BYGXmtEFlJgQSydFd88huHWJNLEScbmnjO--eVNBMok,5181
1694
+ fastlife/security/policy.py,sha256=8FWtjcOjkK5UvnjKluVkJIZdec2bfXbkKx7ouiiyjBs,5115
1695
1695
  fastlife/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1696
1696
  fastlife/services/locale_negociator.py,sha256=b1Fsx-r_zIZe0GD8WH1gmslMb0mNrvxuacxD4LNX63o,819
1697
1697
  fastlife/services/policy.py,sha256=ZK4K3fVGT1fUeBdo5sSWnEcJg49CZuaI3z2gyg3KguQ,1653
@@ -1707,7 +1707,7 @@ fastlife/testing/__init__.py,sha256=vuqwoNUd3BuIp3fm7nkvmYkIGjIimf5zUGhDkeWrg2s,
1707
1707
  fastlife/testing/testclient.py,sha256=BC7lLQ_jc59UmknAKzgRtW9a3cpX_V_QLp9Mg2ScLA8,20546
1708
1708
  fastlife/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1709
1709
  fastlife/views/pydantic_form.py,sha256=ZYOXKudmSqtRvFn5ZY75DOXZVunGXJBKpjh9FJcqu6k,1386
1710
- fastlifeweb-0.16.0.dist-info/LICENSE,sha256=F75xSseSKMwqzFj8rswYU6NWS3VoWOc_gY3fJYf9_LI,1504
1711
- fastlifeweb-0.16.0.dist-info/METADATA,sha256=Q875Q1ELgr_qbBTGf5huMPCQwpwqovev2_OU0CNX4yU,3345
1712
- fastlifeweb-0.16.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1713
- fastlifeweb-0.16.0.dist-info/RECORD,,
1710
+ fastlifeweb-0.16.2.dist-info/LICENSE,sha256=F75xSseSKMwqzFj8rswYU6NWS3VoWOc_gY3fJYf9_LI,1504
1711
+ fastlifeweb-0.16.2.dist-info/METADATA,sha256=KIJVtDej45kFERanabt_3BzlEywJ274ZpWAHj3BGJm0,3345
1712
+ fastlifeweb-0.16.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1713
+ fastlifeweb-0.16.2.dist-info/RECORD,,