Explorer
/proc/123/root/tmp/patch_status023.py
← Zurück ↓ Download
from pathlib import Path
p=Path('/opt/struktur/social-media-agent/app.py')
s=p.read_text()
old='''        limit=100, days=days, sort="relevance", competition_only=True
    )'''
new='''        limit=100, days=days, sort="relevance", status_filter=status_filter, competition_only=True
    )'''
if old not in s: raise SystemExit('competition call anchor missing')
p.write_text(s.replace(old,new,1))

p=Path('/opt/struktur/social-media-agent/templates/cockpit.html')
s=p.read_text()
s=s.replace('/cockpit?days={{d}}&sort={{sort}}&tab={{tab}}', '/cockpit?days={{d}}&sort={{sort}}&tab={{tab}}{% if status_filter %}&status={{status_filter|urlencode}}{% endif %}', 1)
s=s.replace('/cockpit?days={{days}}&sort={{sk}}&tab={{tab}}', '/cockpit?days={{days}}&sort={{sk}}&tab={{tab}}{% if status_filter %}&status={{status_filter|urlencode}}{% endif %}', 1)
s=s.replace('{{cat_sigs|length}} Ereignis{% if cat_sigs|length != 1 %}se{% endif %}', '{{cat_sigs|length}} Rohereignis{% if cat_sigs|length != 1 %}se{% endif %}', 1)
p.write_text(s)