diff --git a/ext_check.py b/ext_check.py index 63113a0..a40787a 100644 --- a/ext_check.py +++ b/ext_check.py @@ -25,6 +25,11 @@ import fgis_client as fc import pravo_client as pc +# Уровни, о которых сообщаем письмом и которые считаем «важными» в отчёте. +# Один список на оба места: иначе тема письма и состав рассылки разъезжаются. +IMPORTANT_LEVELS = ("update", "problem") + + def _regions() -> list[int]: raw = os.environ.get("EXT_REGIONS", "").strip() if raw.lower() == "all": @@ -332,7 +337,7 @@ def _notify(findings: list[dict]) -> bool: import html as _html def esc(v): return _html.escape(str(v or "")) - updates = [f for f in findings if f["level"] in ("update", "problem")] + updates = [f for f in findings if f["level"] in IMPORTANT_LEVELS] rows = "".join( f"
  • [{esc(f['level'])}] {esc(f['source'])}: {esc(f['message'])}" + (f"
    {esc(f['action'])}" if f.get("action") else "") @@ -517,7 +522,7 @@ def _run_check_body(regions: list[int] | None, *, notify: bool) -> dict: findings += f _write_report(findings, regions) - updates = [f for f in findings if f["level"] in ("update", "problem")] + updates = [f for f in findings if f["level"] in IMPORTANT_LEVELS] notify_ok = True доставлено = not updates if notify and updates: