1
0
Fork 0

Adding 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:00 +01:00
parent aa3901dc08
commit cece8fcfb0
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
strategy:
matrix:
python: ["3.10", "3.11", "3.12"]
python: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: false
runs-on: ubuntu-latest
steps:

View file

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

View file

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

View file

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

View file

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