Skip to main content

splent_feature_post

The post feature of a SPLENT product line.

A SPLENT feature is a Python package that a product composes with others. Its models, routes, services, templates and hooks are registered when the product starts. What this feature provides and requires is listed in the [tool.splent.contract] section of pyproject.toml, which splent feature:contract --write keeps in sync with the source.

What it does

Blog posts with categories. The public index lives at POST_INDEX_PATH (/blog by default), each category at <index>/category/<slug>, and each post at the permalink POST_PERMALINK describes (/%Y/%m/%d/%postname% by default). A draft, or a published post dated in the future, answers 404 until its time comes. The home page gets a latest posts section through the home.section hook.

The panel manages the posts at /admin/posts, where they are written, edited, previewed before they go live and deleted.

A post's content and excerpt are stored HTML, and every page that shows them, the preview included, draws them through the framework's rich_text filter, which keeps the formatting and drops scripts, event handlers and javascript: links.

The panel writes the content with a small editor bundled with the feature (assets/vendor/splent-editor.js), and the stored body never runs there either. The editor parses the stored body, anything pasted and the HTML typed in its source view into an inert document, where no script runs and no image loads. There it drops the elements that run or load something (script, style, object, svg, form controls and the like), every on* and style attribute and every address that is not http, https, mailto or relative, and only then moves the nodes into the editing surface.

An iframe stays, so a post that embeds a YouTube or Vimeo player keeps it when it is edited and saved. It loses its on* handlers, srcdoc, name and style, and its src when that is not https, which leaves an empty frame the author can still see. The rich_text filter and RICH_TEXT_EMBED_HOSTS still decide which players the public pages show.

Access

The screens under /admin/posts, the preview of a draft among them, open for the accounts whose role is admin or staff, the same pair the admin dashboard lets in. Any other signed-in account gets 403 and does not see the Posts link in the sidebar, and an anonymous visitor is sent to log in. The public blog stays open to everyone, signed in or not. A draft or a scheduled post answers 404 there for every account, the panel's included, and the panel checks it through the preview.

There is no setting for these roles, and a refinement cannot replace the views that check them, because it may add routes to this feature but never replace one of its own. Another feature can decide for these screens with an access policy registered for the prefix post.admin (register_access_policy, splent_framework 1.20.0). The framework asks the policy before the roles. It answers True to let an account in, False to refuse it, or None to leave the decision to the roles, and the sidebar link follows the same answer. That is the way to let a group of accounts manage only this section, for example the editors of the blog, without giving them a panel role. See Access control.

Without such a feature, give the person's account the staff role. Staff opens every panel screen that asks for PANEL_ROLES, not only this one, so a person who should manage nothing but the posts needs a policy instead.

splent feature:auth set-role someone@example.com staff

Use it in a product

splent feature:add splent_feature_post

Develop

splent feature:test splent_feature_post
splent feature:contract splent_feature_post

Release

splent feature:release splent_feature_post --dry-run --bump patch
splent feature:release splent_feature_post

The first command rehearses the release and changes nothing. The second publishes it to the git forge and to PyPI, and a PyPI version is permanent.

Metadata

Release files for splent-feature-post 0.7.0

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

Source distribution (sdist)

Source distribution for splent-feature-post 0.7.0
File Size Uploaded Provenance Actions
splent_feature_post-0.7.0.tar.gz 47.2 kB Without provenance Details for splent_feature_post-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for splent-feature-post 0.7.0
File Interpreter ABI Platform Actions
splent_feature_post-0.7.0-py3-none-any.whl Python 3 none any Details for splent_feature_post-0.7.0-py3-none-any.whl

Total release size: 105.2 kB

Release files / splent_feature_post-0.7.0.tar.gz

Download URL splent_feature_post-0.7.0.tar.gz
Size 47.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ffd2a2db9face0820789a4593e5e78103ed1b16183e2f592f8d92084bad33228
BLAKE2b-256 checksum
How to use checksums
81723dbb81f47ef230270f0b37a54e819edbfab67529324acd3cc8c08cfdbc2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / splent_feature_post-0.7.0-py3-none-any.whl

Download URL splent_feature_post-0.7.0-py3-none-any.whl
Size 58.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6e16cbf02c42f43a02c59fc16d0c40b86014e2564728bcbdebbb653a6220ecf
BLAKE2b-256 checksum
How to use checksums
4a64db617e376797da5b9d7911f3af7019f673b6148f93cd5d8ea1fadc82587c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for splent-feature-post 0.7.0

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