plain.htmx 0.11.1__py3-none-any.whl → 0.12.0__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.
- plain/htmx/CHANGELOG.md +10 -0
- plain/htmx/templates.py +2 -1
- plain/htmx/views.py +11 -8
- {plain_htmx-0.11.1.dist-info → plain_htmx-0.12.0.dist-info}/METADATA +1 -1
- {plain_htmx-0.11.1.dist-info → plain_htmx-0.12.0.dist-info}/RECORD +7 -7
- {plain_htmx-0.11.1.dist-info → plain_htmx-0.12.0.dist-info}/WHEEL +0 -0
- {plain_htmx-0.11.1.dist-info → plain_htmx-0.12.0.dist-info}/licenses/LICENSE +0 -0
plain/htmx/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# plain-htmx changelog
|
|
2
2
|
|
|
3
|
+
## [0.12.0](https://github.com/dropseed/plain/releases/plain-htmx@0.12.0) (2025-11-12)
|
|
4
|
+
|
|
5
|
+
### What's changed
|
|
6
|
+
|
|
7
|
+
- Improved type checking compatibility by adding type ignore comments for mixin methods and ensuring proper None handling ([f4dbcef](https://github.com/dropseed/plain/commit/f4dbcef))
|
|
8
|
+
|
|
9
|
+
### Upgrade instructions
|
|
10
|
+
|
|
11
|
+
- No changes required
|
|
12
|
+
|
|
3
13
|
## [0.11.1](https://github.com/dropseed/plain/releases/plain-htmx@0.11.1) (2025-10-31)
|
|
4
14
|
|
|
5
15
|
### What's changed
|
plain/htmx/templates.py
CHANGED
|
@@ -21,10 +21,11 @@ class HTMXJSExtension(InclusionTagExtension):
|
|
|
21
21
|
def get_context(
|
|
22
22
|
self, context: dict[str, Any], *args: Any, **kwargs: Any
|
|
23
23
|
) -> dict[str, Any]:
|
|
24
|
+
request = context.get("request")
|
|
24
25
|
return {
|
|
25
26
|
"DEBUG": settings.DEBUG,
|
|
26
27
|
"extensions": kwargs.get("extensions", []),
|
|
27
|
-
"csp_nonce":
|
|
28
|
+
"csp_nonce": request.csp_nonce if request else None, # type: ignore[attr-defined]
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
|
plain/htmx/views.py
CHANGED
|
@@ -10,9 +10,12 @@ from .templates import render_template_fragment
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class HTMXViewMixin:
|
|
13
|
+
"""Mixin for View classes to add HTMX-specific functionality."""
|
|
14
|
+
|
|
13
15
|
def render_template(self) -> str:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
# These methods are provided by the View base class
|
|
17
|
+
template = self.get_template() # type: ignore[attr-defined]
|
|
18
|
+
context = self.get_template_context() # type: ignore[attr-defined]
|
|
16
19
|
|
|
17
20
|
if self.is_htmx_request() and self.get_htmx_fragment_name():
|
|
18
21
|
return render_template_fragment(
|
|
@@ -24,7 +27,7 @@ class HTMXViewMixin:
|
|
|
24
27
|
return template.render(context)
|
|
25
28
|
|
|
26
29
|
def get_response(self) -> Response:
|
|
27
|
-
response = super().get_response()
|
|
30
|
+
response = super().get_response() # type: ignore[misc]
|
|
28
31
|
# Tell browser caching to also consider the fragment header,
|
|
29
32
|
# not just the url/cookie.
|
|
30
33
|
patch_vary_headers(
|
|
@@ -36,7 +39,7 @@ class HTMXViewMixin:
|
|
|
36
39
|
if self.is_htmx_request():
|
|
37
40
|
# You can use an htmx_{method} method on views
|
|
38
41
|
# (or htmx_{method}_{action} for specific actions)
|
|
39
|
-
method = f"htmx_{self.request.method.lower()}"
|
|
42
|
+
method = f"htmx_{self.request.method.lower()}" # type: ignore[attr-defined]
|
|
40
43
|
|
|
41
44
|
if action := self.get_htmx_action_name():
|
|
42
45
|
# If an action is specified, we throw an error if
|
|
@@ -49,14 +52,14 @@ class HTMXViewMixin:
|
|
|
49
52
|
# to a regular post method if it's not found
|
|
50
53
|
return handler
|
|
51
54
|
|
|
52
|
-
return super().get_request_handler()
|
|
55
|
+
return super().get_request_handler() # type: ignore[misc]
|
|
53
56
|
|
|
54
57
|
def is_htmx_request(self) -> bool:
|
|
55
|
-
return self.request.headers.get("HX-Request") == "true"
|
|
58
|
+
return self.request.headers.get("HX-Request") == "true" # type: ignore[attr-defined]
|
|
56
59
|
|
|
57
60
|
def get_htmx_fragment_name(self) -> str:
|
|
58
61
|
# A custom header that we pass with the {% htmxfragment %} tag
|
|
59
|
-
return self.request.headers.get("Plain-HX-Fragment", "")
|
|
62
|
+
return self.request.headers.get("Plain-HX-Fragment", "") # type: ignore[attr-defined]
|
|
60
63
|
|
|
61
64
|
def get_htmx_action_name(self) -> str:
|
|
62
|
-
return self.request.headers.get("Plain-HX-Action", "")
|
|
65
|
+
return self.request.headers.get("Plain-HX-Action", "") # type: ignore[attr-defined]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
plain/htmx/CHANGELOG.md,sha256=
|
|
1
|
+
plain/htmx/CHANGELOG.md,sha256=HUzrPifeJtblhFGvtZkXw6CoEyS5Lrosvsz0KcsLyrE,3496
|
|
2
2
|
plain/htmx/README.md,sha256=C9H_66JD9tykCiTbKjZFAzX7MkVrym58wsEaA1wjxqY,12690
|
|
3
3
|
plain/htmx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
plain/htmx/templates.py,sha256=
|
|
5
|
-
plain/htmx/views.py,sha256=
|
|
4
|
+
plain/htmx/templates.py,sha256=Dklc6WIL87sBo-gYmVq8kAPHcJ1BoxcZClJ4WWvHRQ8,6672
|
|
5
|
+
plain/htmx/views.py,sha256=A29O8Gk1MpJVsDuVIjCZc0dBwxuVBCCd2ydU5wgKKwU,2591
|
|
6
6
|
plain/htmx/assets/htmx/plainhtmx.js,sha256=rFFS_ogFTAeON7EX6HRwbyKH3voM5MVcPFfQzSX77cY,2014
|
|
7
7
|
plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-ext.js,sha256=UvnPpQ3Jg380QwIF5PzlxmUQJuoMt6BxsmS_PMd2ayM,48004
|
|
8
8
|
plain/htmx/assets/htmx/vendor/idiomorph/idiomorph-ext.min.js,sha256=Ax3YbD9-2A-Ha_81wI5E4NLHHOjAvNJw4GvDocg2i-s,10313
|
|
@@ -44,7 +44,7 @@ plain/htmx/assets/htmx/vendor/src/ext/restored.js,sha256=0td3Ga2ZIcVdFKJm6FoCXTm
|
|
|
44
44
|
plain/htmx/assets/htmx/vendor/src/ext/sse.js,sha256=ju2N9N81ASa-ncT6JJbm65iQ4y9iAqKXRuPDwOcATBM,10320
|
|
45
45
|
plain/htmx/assets/htmx/vendor/src/ext/ws.js,sha256=KMVp1yOrFb6ncZUprsnN3OPRpmV9GG0YBuLSW1wekMc,13899
|
|
46
46
|
plain/htmx/templates/htmx/js.html,sha256=4G-EW1NWhqzXVtgND5rqkOmwgCO8XEGfvJTw4gy_BSA,883
|
|
47
|
-
plain_htmx-0.
|
|
48
|
-
plain_htmx-0.
|
|
49
|
-
plain_htmx-0.
|
|
50
|
-
plain_htmx-0.
|
|
47
|
+
plain_htmx-0.12.0.dist-info/METADATA,sha256=bRNrs_Rac5UpmA1zccb42_06XSzOVF_1RcPnFibtVtU,12999
|
|
48
|
+
plain_htmx-0.12.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
49
|
+
plain_htmx-0.12.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
|
|
50
|
+
plain_htmx-0.12.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|