merge: fix datetime.utcnow() deprecation warnings across all files

Replaces 94 occurrences of deprecated datetime.utcnow() and
datetime.utcfromtimestamp() across 22 files with utcnow()/utcnow_iso()
helpers. Zero DeprecationWarnings remain. All 1201 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-02-24 10:36:26 +01:00
27 changed files with 199 additions and 166 deletions

View File

@@ -17,6 +17,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
to the methodology page (hub-and-spoke internal linking).
### Fixed
- **`datetime.utcnow()` deprecation warnings** — replaced all 94 occurrences
across 22 files (source + tests) with `utcnow()` / `utcnow_iso()` helpers
from `core.py`. `utcnow_iso()` produces `YYYY-MM-DD HH:MM:SS` (space
separator) matching SQLite's `datetime('now')` format so lexicographic SQL
comparisons stay correct. `datetime.utcfromtimestamp()` in `seo/_bing.py`
also replaced with `datetime.fromtimestamp(ts, tz=UTC)`. Zero deprecation
warnings remain.
- **Credit ledger ordering** — `get_ledger()` now uses `ORDER BY created_at
DESC, id DESC` to preserve insertion order when multiple credits are added
within the same second.
- **Double language prefix in article URLs** — articles were served at
`/en/en/markets/italy` (double prefix) because `generate_articles()` stored
`url_path` with the lang prefix baked in, but the blueprint is already mounted