aeat.domain.portals._entries._common module

Shared helpers for constructing per-portal entries.

Each entry module in aeat.domain.portals._entries calls build_entry() to turn a compact set of keyword arguments into a fully validated PortalMetadata. Keeping this glue private isolates the repetitive construction boilerplate from the per-portal data tables.

portal_path(portal)[source]

Return the centralized relative path for a portal catalogue entry.

The Portal value addresses the external-constants portal path registry.

Return type:

str

Parameters:

portal (Portal)

build_entry(*, portal, subdomain, category, auth_methods, url_stability, label, purpose, url=None, path=None, active=True, replaced_by=None, notes=())[source]

Assemble a PortalMetadata entry for a single portal.

Exactly one of url or path must be supplied. When path is given, the absolute origin is resolved from the external constants registry against subdomain; this keeps per-portal files free of host duplication.

Parameters:
  • portal (Portal) – The Portal member this entry describes.

  • subdomain (PortalHost) – The PortalHost the URL is hosted on.

  • category (PortalCategory) – The PortalCategory classification.

  • auth_methods (Iterable[AuthMethod]) – Iterable of accepted AuthMethod values.

  • url_stability (UrlStability) – The UrlStability tier.

  • label (str) – Multilingual display label key.

  • purpose (str) – Multilingual purpose description key.

  • url (str | None) – Canonical absolute HTTPS URL. Mutually exclusive with path.

  • path (str | None) – Path component (must start with /). The host is resolved from the registry via subdomain.

  • active (bool) – Whether the portal is currently in service.

  • replaced_by (Portal | None) – When retired, optionally the Portal member that supersedes this one.

  • notes (Iterable[str]) – Iterable of multilingual note keys.

Return type:

PortalMetadata

Returns:

A validated, frozen PortalMetadata.

Raises:

PortalValidationError – If neither or both of url and path are supplied, or if path does not start with /.