hyperclass 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- {hyperclass-0.1.0 → hyperclass-0.1.1}/PKG-INFO +4 -3
- {hyperclass-0.1.0 → hyperclass-0.1.1}/README.md +3 -2
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/__init__.py +1 -1
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/django.py +1 -1
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/PKG-INFO +4 -3
- {hyperclass-0.1.0 → hyperclass-0.1.1}/pyproject.toml +1 -1
- {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_django.py +1 -1
- {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_flask.py +15 -0
- hyperclass-0.1.1/tests/test_package.py +5 -0
- hyperclass-0.1.0/tests/test_package.py +0 -5
- {hyperclass-0.1.0 → hyperclass-0.1.1}/LICENSE +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/__main__.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/binding.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/css.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/flask.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/html.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/htmx.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/lite.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/rendering.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/routing.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/wsgi.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/SOURCES.txt +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/dependency_links.txt +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/requires.txt +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/top_level.txt +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/setup.cfg +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_bookmarks.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_cli.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_html.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_htmx.py +0 -0
- {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_wsgi.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyperclass
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Build interactive web applications as Python class hierarchies.
|
|
5
5
|
Author: Grant Jenks
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -427,8 +427,9 @@ urlpatterns = [
|
|
|
427
427
|
Handlers receive native `HttpRequest` objects and may return native
|
|
428
428
|
`HttpResponse` objects. Routes sharing a path are dispatched by HTTP method,
|
|
429
429
|
and route references use Django `reverse()`, including the mount and namespace.
|
|
430
|
-
Full Hyperclass pages
|
|
431
|
-
CSRF cookie, so unsafe htmx
|
|
430
|
+
Full Hyperclass pages emit htmx 4's explicit `hx-headers:inherited` modifier
|
|
431
|
+
with an `X-CSRFToken` header and request a Django CSRF cookie, so unsafe htmx
|
|
432
|
+
requests work with `CsrfViewMiddleware` enabled.
|
|
432
433
|
|
|
433
434
|
### htmx 4
|
|
434
435
|
|
|
@@ -391,8 +391,9 @@ urlpatterns = [
|
|
|
391
391
|
Handlers receive native `HttpRequest` objects and may return native
|
|
392
392
|
`HttpResponse` objects. Routes sharing a path are dispatched by HTTP method,
|
|
393
393
|
and route references use Django `reverse()`, including the mount and namespace.
|
|
394
|
-
Full Hyperclass pages
|
|
395
|
-
CSRF cookie, so unsafe htmx
|
|
394
|
+
Full Hyperclass pages emit htmx 4's explicit `hx-headers:inherited` modifier
|
|
395
|
+
with an `X-CSRFToken` header and request a Django CSRF cookie, so unsafe htmx
|
|
396
|
+
requests work with `CsrfViewMiddleware` enabled.
|
|
396
397
|
|
|
397
398
|
### htmx 4
|
|
398
399
|
|
|
@@ -143,7 +143,7 @@ class App:
|
|
|
143
143
|
is_htmx=request.headers.get("HX-Request", "").lower() == "true",
|
|
144
144
|
url_resolver=self.resolve_url,
|
|
145
145
|
body_attributes={
|
|
146
|
-
"
|
|
146
|
+
"hx-headers:inherited": json.dumps(
|
|
147
147
|
{"X-CSRFToken": get_token(request)}, separators=(",", ":")
|
|
148
148
|
)
|
|
149
149
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyperclass
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Build interactive web applications as Python class hierarchies.
|
|
5
5
|
Author: Grant Jenks
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -427,8 +427,9 @@ urlpatterns = [
|
|
|
427
427
|
Handlers receive native `HttpRequest` objects and may return native
|
|
428
428
|
`HttpResponse` objects. Routes sharing a path are dispatched by HTTP method,
|
|
429
429
|
and route references use Django `reverse()`, including the mount and namespace.
|
|
430
|
-
Full Hyperclass pages
|
|
431
|
-
CSRF cookie, so unsafe htmx
|
|
430
|
+
Full Hyperclass pages emit htmx 4's explicit `hx-headers:inherited` modifier
|
|
431
|
+
with an `X-CSRFToken` header and request a Django CSRF cookie, so unsafe htmx
|
|
432
|
+
requests work with `CsrfViewMiddleware` enabled.
|
|
432
433
|
|
|
433
434
|
### htmx 4
|
|
434
435
|
|
|
@@ -66,7 +66,7 @@ def test_django_reverses_namespaced_routes_and_supplies_csrf():
|
|
|
66
66
|
text = response.content.decode()
|
|
67
67
|
assert 'action="/mounted/items/7"' in text
|
|
68
68
|
assert 'hx-post="/mounted/items/7"' in text
|
|
69
|
-
assert "hx-headers=" in text
|
|
69
|
+
assert "hx-headers:inherited=" in text
|
|
70
70
|
assert "X-CSRFToken" in unescape(text)
|
|
71
71
|
assert "csrftoken" in response.cookies
|
|
72
72
|
|
|
@@ -4,6 +4,7 @@ from flask import Request, Response
|
|
|
4
4
|
|
|
5
5
|
from hyperclass import div, form, get, hx, post, render
|
|
6
6
|
from hyperclass.flask import App
|
|
7
|
+
from examples.bookmarks import BookmarkRoutes
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
@dataclass
|
|
@@ -68,3 +69,17 @@ def test_flask_instance_decorators_return_route_references():
|
|
|
68
69
|
|
|
69
70
|
assert render(form(action=index)) == '<form action="/"></form>'
|
|
70
71
|
assert app.test_client().get("/").text.endswith("<div>dynamic</div></body></html>")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_flask_bookmark_routes_read_native_query_keys(tmp_path):
|
|
75
|
+
class Bookmarks(BookmarkRoutes, App):
|
|
76
|
+
pass
|
|
77
|
+
|
|
78
|
+
app = Bookmarks(tmp_path / "flask-query.db")
|
|
79
|
+
app.store.add("https://python.org", "Python")
|
|
80
|
+
response = app.test_client().get(
|
|
81
|
+
"/bookmarks?q=missing&filter=all",
|
|
82
|
+
headers={"HX-Request": "true"},
|
|
83
|
+
)
|
|
84
|
+
assert response.status_code == 200
|
|
85
|
+
assert "No bookmarks matching "missing"." in response.text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|