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.
Files changed (31) hide show
  1. {hyperclass-0.1.0 → hyperclass-0.1.1}/PKG-INFO +4 -3
  2. {hyperclass-0.1.0 → hyperclass-0.1.1}/README.md +3 -2
  3. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/__init__.py +1 -1
  4. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/django.py +1 -1
  5. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/PKG-INFO +4 -3
  6. {hyperclass-0.1.0 → hyperclass-0.1.1}/pyproject.toml +1 -1
  7. {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_django.py +1 -1
  8. {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_flask.py +15 -0
  9. hyperclass-0.1.1/tests/test_package.py +5 -0
  10. hyperclass-0.1.0/tests/test_package.py +0 -5
  11. {hyperclass-0.1.0 → hyperclass-0.1.1}/LICENSE +0 -0
  12. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/__main__.py +0 -0
  13. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/binding.py +0 -0
  14. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/css.py +0 -0
  15. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/flask.py +0 -0
  16. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/html.py +0 -0
  17. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/htmx.py +0 -0
  18. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/lite.py +0 -0
  19. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/rendering.py +0 -0
  20. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/routing.py +0 -0
  21. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass/wsgi.py +0 -0
  22. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/SOURCES.txt +0 -0
  23. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/dependency_links.txt +0 -0
  24. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/requires.txt +0 -0
  25. {hyperclass-0.1.0 → hyperclass-0.1.1}/hyperclass.egg-info/top_level.txt +0 -0
  26. {hyperclass-0.1.0 → hyperclass-0.1.1}/setup.cfg +0 -0
  27. {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_bookmarks.py +0 -0
  28. {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_cli.py +0 -0
  29. {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_html.py +0 -0
  30. {hyperclass-0.1.0 → hyperclass-0.1.1}/tests/test_htmx.py +0 -0
  31. {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.0
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 inherit an htmx `X-CSRFToken` header and request a Django
431
- CSRF cookie, so unsafe htmx requests work with `CsrfViewMiddleware` enabled.
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 inherit an htmx `X-CSRFToken` header and request a Django
395
- CSRF cookie, so unsafe htmx requests work with `CsrfViewMiddleware` enabled.
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
 
@@ -63,7 +63,7 @@ from .lite import (
63
63
  )
64
64
  from .wsgi import delete as delete_route
65
65
 
66
- __version__ = "0.1.0"
66
+ __version__ = "0.1.1"
67
67
 
68
68
  hidden = "hidden"
69
69
  submit = "submit"
@@ -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
- "hx_headers": json.dumps(
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.0
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 inherit an htmx `X-CSRFToken` header and request a Django
431
- CSRF cookie, so unsafe htmx requests work with `CsrfViewMiddleware` enabled.
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
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperclass"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Build interactive web applications as Python class hierarchies."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -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 &quot;missing&quot;." in response.text
@@ -0,0 +1,5 @@
1
+ import hyperclass
2
+
3
+
4
+ def test_version():
5
+ assert hyperclass.__version__ == "0.1.1"
@@ -1,5 +0,0 @@
1
- import hyperclass
2
-
3
-
4
- def test_version():
5
- assert hyperclass.__version__ == "0.1.0"
File without changes
File without changes
File without changes
File without changes