Skip to main content

stoic-html

What is "stoic-html"?

Stoic HTML is a tiny wrapper around the method format_html() of the Django web framework.

Since I switched to developing the frontend with htmx.org I tend to write small function-based-views returning small HTML fragments.

That's why I switched from using a template language to creating the HTML directly inside my Python code.

That's in general considered dirty, and frowned upon.

For me it is Locality of Behaviour: I have all these things together in one place. That gives me a lot of power and speed.

Methods

Method join()

join(my_list, sep='', type=None, empty_text='')

Joins a list of strings to a SafeString with the help of conditional_escape()

type can be 'ul' or 'ol' to create HTML lists.

link(obj, text=None)

Create a hyperlink to obj.

Returns something like 'text'

If "text" is empty, then str(obj) gets used.

admin_link(obj, text=None)

Returns a link to the admin-page of obj.

If "text" is empty, then str(obj) gets used.

Install

python3 -m venv stoic-html-env
cd stoic-html-env/
. bin/activate
pip install -U pip wheel
pip install -e git+ssh://git@github.com/guettli/stoic-html.git#egg=stoic-html
cp src/stoic-html/.env.example src/stoic-html/.env
echo '. $VIRTUAL_ENV/src/stoic-html/.env' >> bin/activate
echo 'export $(cut -d= -f1 $VIRTUAL_ENV/src/stoic-html/.env)' >> bin/activate

. bin/activate

Naming convention

See: https://github.com/guettli/django-htmx-fun

Guidelines

See: https://github.com/guettli/programming-guidelines

Metadata

Release files for stoic-html 2021.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for stoic-html 2021.9.3
File Interpreter ABI Platform Actions
stoic_html-2021.9.3-py3-none-any.whl Python 3 none any Details for stoic_html-2021.9.3-py3-none-any.whl

Release files / stoic_html-2021.9.3-py3-none-any.whl

Download URL stoic_html-2021.9.3-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c29194e07f93b257a8c9eacd611e228b756bd26eb29935029d47a6db734d28d2
BLAKE2b-256 checksum
How to use checksums
aaa69e22f8ce19a9c2b2771a0bf7f20c6d363badcf4e0e6f508146568782d3a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10

Security for stoic-html 2021.9.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page