No description
  • Python 81.4%
  • HTML 16.5%
  • JavaScript 1.3%
  • Mako 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-08 11:00:11 +01:00
src chore: refresh translation template 2026-11-08 11:00:11 +01:00
.gitignore fix: ship the compiled translations, so a released feature is actually translated 2026-07-30 18:15:10 +02:00
COPYING License under LGPL-3.0-or-later 2026-10-11 11:48:25 +02:00
COPYING.LESSER License under LGPL-3.0-or-later 2026-10-11 11:48:25 +02:00
MANIFEST.in feat: ship the real tool logos instead of hotlinking GitHub avatars 2026-08-12 16:37:41 +02:00
pyproject.toml fix: deletions ask with the framework's data-confirm, which a Content-Security-Policy without 'unsafe-inline' still runs 2026-10-30 23:48:53 +01:00
README.md fix: refuse unsafe tool addresses and draw them through safe_url 2026-10-21 07:08:50 +02:00

splent_feature_tools

The tools 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

A catalogue of tools. /tools lists the published tools grouped by status (active, prototype, other), and /tools/<slug> shows one of them with its description, logo and links. A tool that is not published stays out of the list, and its page answers 404 to everyone but the panel's accounts, who see it with a notice that it is a draft. The description is stored HTML, and the page draws it through the framework's rich_text filter, which keeps the formatting and drops scripts, event handlers and javascript: links.

The panel manages the tools at /admin/tools, where they are added, edited, moved to another group and deleted.

Addresses

A tool's logo goes into a src and its GitHub and website addresses into an href, so the form checks them with the framework's is_safe_url before storing them. An http://, https:// or mailto: address and a path on the site such as /static/uploads/logo.png are stored. Any other scheme, javascript: and data: among them, is refused with a message, nothing is saved, and the form comes back with what was typed.

The pages draw every stored address through the safe_url filter, so one a seeder or an import wrote without the check renders as an empty href or src instead of running.

Access

The screens under /admin/tools 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 Tools link in the sidebar, and an anonymous visitor is sent to log in.

The published list and detail pages stay open to everyone, signed in or not. The page of a draft at /tools/<slug> opens only to the accounts the admin screens let in, so they can check it before publishing, with a notice that the public cannot see it. Everyone else gets 404, as for a tool that does not exist. The notice is a flashed message that the page layout shows, so it stays when a refinement overrides the detail template.

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 tools.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 and the preview of a draft follow the same answer. For the preview the policy is asked about tools.admin_index with the draft's slug as view_args, {"slug": "<slug>"}, so it can let an account preview some drafts and not others. That is the way to let a group of accounts manage only this section, for example the maintainers of the tools, 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 tools needs a policy instead.

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

Use it in a product

splent feature:add splent_feature_tools

Develop

splent feature:test splent_feature_tools
splent feature:contract splent_feature_tools

Release

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

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.