litestar-vite 0.2.4__py3-none-any.whl → 0.2.6__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.
Potentially problematic release.
This version of litestar-vite might be problematic. Click here for more details.
- litestar_vite/inertia/response.py +10 -6
- {litestar_vite-0.2.4.dist-info → litestar_vite-0.2.6.dist-info}/METADATA +1 -1
- {litestar_vite-0.2.4.dist-info → litestar_vite-0.2.6.dist-info}/RECORD +5 -5
- {litestar_vite-0.2.4.dist-info → litestar_vite-0.2.6.dist-info}/WHEEL +0 -0
- {litestar_vite-0.2.4.dist-info → litestar_vite-0.2.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,7 +7,7 @@ from mimetypes import guess_type
|
|
|
7
7
|
from pathlib import PurePath
|
|
8
8
|
from textwrap import dedent
|
|
9
9
|
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Mapping, TypeVar, cast
|
|
10
|
-
from urllib.parse import quote
|
|
10
|
+
from urllib.parse import quote, urlparse, urlunparse
|
|
11
11
|
|
|
12
12
|
from litestar import Litestar, MediaType, Request, Response
|
|
13
13
|
from litestar.datastructures.cookie import Cookie
|
|
@@ -72,11 +72,12 @@ def get_shared_props(request: ASGIConnection[Any, Any, Any, Any]) -> Dict[str, A
|
|
|
72
72
|
Be sure to call this before `self.create_template_context` if you would like to include the `flash` message details.
|
|
73
73
|
"""
|
|
74
74
|
props: dict[str, Any] = {}
|
|
75
|
+
flash: dict[str, list[str]] = defaultdict(list)
|
|
76
|
+
errors: dict[str, Any] = {}
|
|
77
|
+
error_bag = request.headers.get("X-Inertia-Error-Bag", None)
|
|
75
78
|
try:
|
|
76
|
-
|
|
77
|
-
errors: dict[str, Any] = request.session.pop("_errors", {})
|
|
79
|
+
errors = request.session.pop("_errors", {})
|
|
78
80
|
props.update(cast("Dict[str,Any]", request.session.pop("_shared", {})))
|
|
79
|
-
flash: dict[str, list[str]] = defaultdict(list)
|
|
80
81
|
for message in cast("List[Dict[str,Any]]", request.session.pop("_messages", [])):
|
|
81
82
|
flash[message["category"]].append(message["message"])
|
|
82
83
|
|
|
@@ -85,11 +86,12 @@ def get_shared_props(request: ASGIConnection[Any, Any, Any, Any]) -> Dict[str, A
|
|
|
85
86
|
for session_prop in inertia_plugin.config.extra_session_page_props:
|
|
86
87
|
if session_prop not in props and session_prop in request.session:
|
|
87
88
|
props[session_prop] = request.session.get(session_prop)
|
|
88
|
-
|
|
89
|
-
props["errors"] = {error_bag: errors} if error_bag is not None else errors
|
|
89
|
+
|
|
90
90
|
except AttributeError:
|
|
91
91
|
msg = "Unable to generate all shared props. A valid session was not found for this request."
|
|
92
92
|
request.logger.warning(msg)
|
|
93
|
+
props["flash"] = flash
|
|
94
|
+
props["errors"] = {error_bag: errors} if error_bag is not None else errors
|
|
93
95
|
props["csrf_token"] = value_or_default(ScopeState.from_scope(request.scope).csrf_token, "")
|
|
94
96
|
return props
|
|
95
97
|
|
|
@@ -335,6 +337,8 @@ class InertiaRedirect(Redirect):
|
|
|
335
337
|
"""Initialize external redirect, Set status code to 409 (required by Inertia),
|
|
336
338
|
and pass redirect url.
|
|
337
339
|
"""
|
|
340
|
+
referer = urlparse(request.headers.get("referer", str(request.base_url)))
|
|
341
|
+
redirect_to = urlunparse(urlparse(redirect_to)._replace(scheme=referer.scheme))
|
|
338
342
|
super().__init__(
|
|
339
343
|
path=redirect_to,
|
|
340
344
|
status_code=HTTP_307_TEMPORARY_REDIRECT if request.method == "GET" else HTTP_303_SEE_OTHER,
|
|
@@ -14,7 +14,7 @@ litestar_vite/inertia/exception_handler.py,sha256=HrFa8in0wF9V5PuctG3flIrhhEPsWU
|
|
|
14
14
|
litestar_vite/inertia/middleware.py,sha256=NEDcAoT7GMWA9hEGvANZ3MG5_p3MmZX57RF95T71les,1716
|
|
15
15
|
litestar_vite/inertia/plugin.py,sha256=ebAG9XnDBahttuc7WIUgBd3o_Ys8MdPS273LPNs5H8A,2344
|
|
16
16
|
litestar_vite/inertia/request.py,sha256=hk8m1pmDiMbWhVurRDHfDPD24nMHp56JzUKV6SBDeqA,3665
|
|
17
|
-
litestar_vite/inertia/response.py,sha256=
|
|
17
|
+
litestar_vite/inertia/response.py,sha256=XJuyxTSiFvjZLbs42Lh9sZw8IhZIezJf3cwC8p2NJcw,15886
|
|
18
18
|
litestar_vite/inertia/routes.py,sha256=QksJm2RUfL-WbuhOieYnPXXWO5GYnPtmsYEm6Ef8Yeo,1782
|
|
19
19
|
litestar_vite/inertia/types.py,sha256=tLp0pm1N__hcWC875khf6wH1nuFlKS9-VjDqgsRkXnw,702
|
|
20
20
|
litestar_vite/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -24,7 +24,7 @@ litestar_vite/templates/package.json.j2,sha256=0JWgdTuaSZ25EmCltF_zbqDdpxfvCLeYu
|
|
|
24
24
|
litestar_vite/templates/styles.css.j2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
litestar_vite/templates/tsconfig.json.j2,sha256=q1REIuVyXUHCy4Zi2kgTkmrhdT98vyY89k-WTrImOj8,843
|
|
26
26
|
litestar_vite/templates/vite.config.ts.j2,sha256=FZ4OJaB8Kjby_nlx4_LCP8eCe1LRi8kW2GspCiVMfDY,1115
|
|
27
|
-
litestar_vite-0.2.
|
|
28
|
-
litestar_vite-0.2.
|
|
29
|
-
litestar_vite-0.2.
|
|
30
|
-
litestar_vite-0.2.
|
|
27
|
+
litestar_vite-0.2.6.dist-info/METADATA,sha256=XE7jCLWJ4l4nX8X0w_TNfCBdiFxQ75U_xPZinfxMp7M,6180
|
|
28
|
+
litestar_vite-0.2.6.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
29
|
+
litestar_vite-0.2.6.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
|
|
30
|
+
litestar_vite-0.2.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|