Explorer
/proc/111/root/tmp/aa051_patch_gate.py
← Zurück ↓ Download
from pathlib import Path
p=Path('/opt/struktur/social-media-radar/mas_relevance.py')
s=p.read_text()
old='''    if signal.get("content_blocked") == 1:
        return False, signal.get("content_block_reason") or "fachlich/ethisch blockiert"
'''
new='''    # Nur der explizite Zustand 0 ist freigabefähig; NULL/unbekannt bleibt
    # gemäß AA-051 fail-closed gesperrt.
    if signal.get("content_blocked") != 0:
        return False, signal.get("content_block_reason") or "content_blocked fehlt oder ist nicht 0"
    brand = signal.get("brand") or signal.get("brand_id") or signal.get("profile")
    if brand is not None and str(brand).strip().casefold() not in {"mas", "mallorca-airservices", "mallorca airservices"}:
        return False, "falsche Marke"
'''
if old not in s: raise SystemExit('missing')
p.write_text(s.replace(old,new,1))