refactor: A28 lot 3 — collections.py (2 622 L) → package 13 fichiers (v7.31.0)
Découpe par concern de l'ancien app/routers/collections.py (2 622 lignes, 53 endpoints / 52 fonctions) en package `app/routers/collections/` : - 10 modules de routes : crud 337 L (6 r.), properties 322 (8), linked 286 (7), structure 267 (8), dashboard_views 214 (3), meta 197 (5), views 187 (6), pages 184 (4), data_api 122 (2), boards 61 (3) - _common.py (220 L) : 8 helpers auth/permissions/validation - _renderers.py (667 L) : 15 rendus HTML des vues + CHART_MAX_GROUPS - __init__.py : ré-exports connus (_validate_page_properties pour automations ; _chart_values/_chart_aggregate/_fmt_number/_render_chart pour les tests) + __all__ Preuve contractuelle : docs/openapi-v2.json régénéré = IDENTIQUE byte-à-byte (509 chemins, ordre préservé). Pièges rattrapés : - docstring d'origine conservée dans le header copié → F404 (from __future__ après un statement) → slice [1:30] - décorateurs empilés (view_collection ×2) : segment sans def → skip du 2e décorateur (53 endpoints = 52 unités) - CHART_MAX_GROUPS hors détection des helpers (F821) → import ._renderers - test_csp_no_cdn_and_vendor lisait collections.py → balayage du package Reste A28 : board.py 2 101 L (lot 4). suite **1091/1091** · ruff OK · OpenAPI 509 identique · docs à jour
This commit is contained in:
@@ -293,9 +293,11 @@ def test_csp_no_cdn_and_vendor(client):
|
||||
assert conn == "'self' ws://testserver wss://testserver", conn
|
||||
assert " https:" not in conn and not conn.startswith("https:"), conn
|
||||
|
||||
# vues chart/map : références locales (aucun CDN dans collections.py)
|
||||
src = _pathlib.Path("app/routers/collections.py").read_text(encoding="utf-8")
|
||||
assert "cdn.jsdelivr" not in src and "unpkg.com" not in src
|
||||
# vues chart/map : références locales (aucun CDN — A28 : le fichier
|
||||
# collections.py est devenu un package, on balaie tous ses modules)
|
||||
for src in _pathlib.Path("app/routers/collections").glob("*.py"):
|
||||
text = src.read_text(encoding="utf-8")
|
||||
assert "cdn.jsdelivr" not in text and "unpkg.com" not in text, src
|
||||
|
||||
# assets vendor servis
|
||||
for path in (
|
||||
|
||||
Reference in New Issue
Block a user