Hypermedia

Latest version: v5.3.3

Safety actively analyzes 681812 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

5.3.3

* Fixes bug with svg element dumping. (48)[https://github.com/thomasborgen/hypermedia/issues/48]

5.3.2

* Fixes `style` attribute rendering.

5.3.1

* Adds `lang` as an attribute to the `Html` element.

5.3.0

Feature

* Adds `SafeString` type as a wrapper around the normal `str` class. This can be used to tell hypermedia not to `html.escape` the string in any element.


python
Div("this is always escaped")
Div(SafeString("This will not be escaped"))


* Hypermedia is now cachable - All calls to `.dump()` now returns a `SafeString`. This means that caching a dumped element is now possible because we won't call `html.escape` on it again.

python
lru_cache()
def stylesheets() -> SafeString:
return ElementList(
Link(
rel="stylesheet",
href="/static/css/normalize.css",
type="text/css",
),
Link(
rel="stylesheet",
href="/static/css/simple.min.css",
type="text/css",
)
).dump()

def base():
"""
Once `stylesheets()` is called once, it will always use the cached String in subsequent
calls to `base()`
"""
return ElementList(
Doctype(),
Html(
Head(
Meta(charset="UTF-8"),
stylesheets(),
slot="head",
),
Body(...)
lan="en",
),
)


* `Script` and `Style` elements wraps input in `SafeString` by default.

python
Script("This is wrapped in `SafeString` by default")
Style("This is wrapped in `SafeString` by default")

5.2.0

Feature

* Can now use hyperscript with the `_` attribute that renders as: `_='value'`

Fix

* Fix missing Alias for the `for_` attribute. It now renders correctly as `for='value'`

5.1.0

Fix

* Calling `dump()`, more specifically `render_attributes()` popped out `class_` and `classes` attributes from the element. So subsequent calls would be missing the attributes. [PR](https://github.com/thomasborgen/hypermedia/pull/32)

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.