1
0
Fork 0

Merging upstream version 0.48+dfsg.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-05 18:44:10 +01:00
parent 50222169d0
commit ce98d14931
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
5 changed files with 11 additions and 11 deletions

View file

@ -22,7 +22,7 @@ jobs:
name: tests name: tests
strategy: strategy:
matrix: matrix:
python: ["3.10", "3.11", "3.12"] python: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: false fail-fast: false
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View file

@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: 3.9 python-version: 3.12
- name: "Installs dependencies" - name: "Installs dependencies"
run: | run: |

View file

@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry] [tool.poetry]
name = "jinjax" name = "jinjax"
version = "0.46" version = "0.48"
description = "Replace your HTML templates with Python server-Side components" description = "Replace your HTML templates with Python server-Side components"
authors = ["Juan-Pablo Scaletti <juanpablo@jpscaletti.com>"] authors = ["Juan-Pablo Scaletti <juanpablo@jpscaletti.com>"]
license = "MIT" license = "MIT"

View file

@ -12,7 +12,6 @@ from .component import Component
from .exceptions import ComponentNotFound, InvalidArgument from .exceptions import ComponentNotFound, InvalidArgument
from .html_attrs import HTMLAttrs from .html_attrs import HTMLAttrs
from .jinjax import JinjaX from .jinjax import JinjaX
from .middleware import ComponentsMiddleware
from .utils import DELIMITER, SLASH, get_url_prefix, logger from .utils import DELIMITER, SLASH, get_url_prefix, logger

View file

@ -6,22 +6,23 @@ from pathlib import Path
try: try:
from whitenoise import WhiteNoise from whitenoise import WhiteNoise
from whitenoise.responders import Redirect, StaticFile from whitenoise.responders import Redirect, StaticFile
except ImportError as err : except ImportError:
raise ImportError( WhiteNoise = object
"This feature requires the package `whitenoise` to be installed. \n"
+ "Run `pip install jinjax[whitenoise]` to do it."
) from err
RX_FINGERPRINT = re.compile("(.*)-([abcdef0-9]{64})") RX_FINGERPRINT = re.compile("(.*)-([abcdef0-9]{64})")
class ComponentsMiddleware(WhiteNoise): class ComponentsMiddleware(WhiteNoise): # type: ignore
"""WSGI middleware for serving components assets""" """WSGI middleware for serving components assets"""
allowed_ext: tuple[str, ...] allowed_ext: tuple[str, ...]
def __init__(self, **kwargs) -> None: def __init__(self, **kwargs) -> None:
if WhiteNoise is object:
raise ImportError(
"The ComponentsMiddleware requires the package `whitenoise`"
+ " to be installed. \nRun `pip install jinjax[whitenoise]` to do it."
)
self.allowed_ext = kwargs.pop("allowed_ext", ()) self.allowed_ext = kwargs.pop("allowed_ext", ())
super().__init__(**kwargs) super().__init__(**kwargs)