|
3 | 3 | 2.x Changelog
|
4 | 4 | =============
|
5 | 5 |
|
| 6 | +.. changelog:: 2.15.0 |
| 7 | + :date: 2025-02-26 |
| 8 | + |
| 9 | + .. change:: Prevent accidental ``scope`` key overrides by mounted ASGI apps |
| 10 | + :type: bugfix |
| 11 | + :pr: 3945 |
| 12 | + :issue: 3934 |
| 13 | + |
| 14 | + When mounting ASGI apps, there's no guarantee they won't overwrite some key in |
| 15 | + the ``scope`` that we rely on, e.g. ``scope["app"]``, which is what caused |
| 16 | + https://github.com/litestar-org/litestar/issues/3934. |
| 17 | + |
| 18 | + To prevent this, two thing shave been changed: |
| 19 | + |
| 20 | + 1. We do not store the Litestar instance under the generic ``app`` key anymore, |
| 21 | + but the more specific ``litestar_app`` key. In addition the |
| 22 | + :meth:`~litestar.app.Litestar.from_scope` method has been added, which can be |
| 23 | + used to safely access the current app from the scope |
| 24 | + 2. A new parameter ``copy_scope`` has been added to the ASGI route handler, |
| 25 | + which, when set to ``True`` will copy the scope before calling into the |
| 26 | + mounted ASGI app, aiming to make things behave more as expected, by |
| 27 | + giving the called app its own environment without causing any side-effects. |
| 28 | + Since this change might break some things, It's been left it |
| 29 | + with a default of ``None``, which does not copy the scope, but will issue a |
| 30 | + warning if the mounted app modified it, enabling users to decide how to deal |
| 31 | + with that situation |
| 32 | + |
| 33 | + .. change:: Fix deprecated ``attrs`` import |
| 34 | + :type: bugfix |
| 35 | + :pr: 3947 |
| 36 | + :issue: 3946 |
| 37 | + |
| 38 | + A deprecated import of the ``attrs`` plugins caused a warning. This has been |
| 39 | + fixed. |
| 40 | + |
| 41 | + |
| 42 | + .. change:: JWT: Revoked token handler |
| 43 | + :type: feature |
| 44 | + :pr: 3960 |
| 45 | + |
| 46 | + Add a new ``revoked_token_handler`` on same level as ``retrieve_user_handler``, |
| 47 | + for :class:`~litestar.security.jwt.BaseJWTAuth`. |
| 48 | + |
| 49 | + .. change:: Allow ``route_reverse`` params of type ``uuid`` to be passed as ``str`` |
| 50 | + :type: feature |
| 51 | + :pr: 3972 |
| 52 | + |
| 53 | + Allows params of type ``uuid`` to be passed as strings |
| 54 | + (e.g. their hex representation) into :meth:`~litestar.app.Litestar.route_reverse` |
| 55 | + |
| 56 | + .. change:: CLI: Better error message for invalid ``--app`` string |
| 57 | + :type: feature |
| 58 | + :pr: 3977 |
| 59 | + :issue: 3893 |
| 60 | + |
| 61 | + Improve the error handling when an invalid ``--app`` string is passed |
| 62 | + |
| 63 | + .. change:: DTO: Support ``@property`` fields for msgspec and dataclass |
| 64 | + :type: feature |
| 65 | + :pr: 3981 |
| 66 | + |
| 67 | + Support :class:`property` fields for msgspec and dataclasses during serialization |
| 68 | + and for OpenAPI schema generation. |
| 69 | + |
| 70 | + .. change:: Add new ``ASGIMiddleware`` |
| 71 | + :type: feature |
| 72 | + :pr: 3996 |
| 73 | + |
| 74 | + Add a new base middleware class to facilitate easier configuration and |
| 75 | + middleware dispatching. |
| 76 | + |
| 77 | + The new :class:`~litestar.middleware.ASGIMiddleware` features the same |
| 78 | + functionality as :class:`~litestar.middleware.AbstractMiddleware`, but makes it |
| 79 | + easier to pass configuration directly to middleware classes without a separate |
| 80 | + configuration object, allowing the need to use |
| 81 | + :class:`~litestar.middleware.DefineMiddleware`. |
| 82 | + |
| 83 | + .. seealso:: |
| 84 | + :doc:`/usage/middleware/creating-middleware` |
| 85 | + |
| 86 | + .. change:: Add ``SerializationPlugin`` and ``InitPlugin`` to replace their respective protocols |
| 87 | + :type: feature |
| 88 | + :pr: 4025 |
| 89 | + |
| 90 | + - Add :class:`~litestar.plugins.SerializationPlugin` to replace :class:`~litestar.plugins.SerializationPluginProtocol` |
| 91 | + - Add :class:`~litestar.plugins.InitPlugin` to replace :class:`~litestar.plugins.InitPluginProtocol` |
| 92 | + |
| 93 | + Following the same approach as for other plugins, they inherit their respective |
| 94 | + protocol for now, to keep type / `isinstance` checks compatible. |
| 95 | + |
| 96 | + .. important:: |
| 97 | + The plugin protocols will be removed in version 3.0 |
| 98 | + |
| 99 | + .. change:: Allow passing a ``debugger_module`` to the application |
| 100 | + :type: feature |
| 101 | + :pr: 3967 |
| 102 | + |
| 103 | + A new ``debugger_module`` parameter has been added to |
| 104 | + :class:`~litestar.app.Litestar`, which can receive any debugger module that |
| 105 | + implements a :func:`pdb.post_mortem` function with the same signature as the |
| 106 | + stdlib. This function will be called when an exception occurs and |
| 107 | + ``pdb_on_exception`` is set to ``True``\ . |
| 108 | + |
| 109 | + |
6 | 110 | .. changelog:: 2.14.0
|
7 | 111 | :date: 2025-02-12
|
8 | 112 |
|
|
0 commit comments