---
type: "Source File"
title: "import re"
description: "import re app_path = \"/home/ben/infra/copecheck-cities/app.py\" with open(app_path, \"r\") as f: content = f.read() # Fix 1: articles_index - add countries=COUNTRIES content = content.replace( 'return."
resource: "https://cities.copecheck.com"
tags: ["copecheck", "cities", "source-file", "py"]
timestamp: "2026-05-09T15:11:56Z"
site: "cities"
source_path: "copecheck-cities/fix_articles.py"
---

# import re

Source path: `copecheck-cities/fix_articles.py`  
Index snapshot generated: `2026-11-24T13:27:52Z`  
File modified: `2026-05-09T15:11:56Z`

```py
import re

app_path = "/home/ben/infra/copecheck-cities/app.py"
with open(app_path, "r") as f:
    content = f.read()

# Fix 1: articles_index - add countries=COUNTRIES
content = content.replace(
    'return render_template("articles_index.html", articles=ARTICLES,\n        meta_description="Analysis and rankings from the CopeCheck Cities oracle.")',
    'return render_template("articles_index.html", articles=ARTICLES,\n        countries=COUNTRIES,\n        meta_description="Analysis and rankings from the CopeCheck Cities oracle.")'
)

# Fix 2: article_best - add countries=COUNTRIES
content = content.replace(
    '''return render_template("article.html",
        title="Top 10 Best Cities for the AI Transition",''',
    '''return render_template("article.html",
        countries=COUNTRIES,
        title="Top 10 Best Cities for the AI Transition",'''
)

# Fix 3: article_worst - add countries=COUNTRIES
content = content.replace(
    '''return render_template("article.html",
        title="Top 10 Worst Cities for the AI Transition",''',
    '''return render_template("article.html",
        countries=COUNTRIES,
        title="Top 10 Worst Cities for the AI Transition",'''
)

with open(app_path, "w") as f:
    f.write(content)

print("Fixed all 3 article routes with countries=COUNTRIES")
```
