Name an unknown circuit, layout or year with a 404 instead of a 500

The circuit and track routes walked circuits.json with chained lookups, so an unknown country, locality, circuit
or layout, or a year no layout covers, raised and answered 500 (/circuits/photos.json among them). One lookup now
names the first unknown part and the API answers it 404. numpy loads only where a script uses it, so the models,
and this lookup's test, need the standard library alone.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
This commit is contained in:
2026-11-27 15:13:34 +01:00
parent db5c19f0d4
commit d514eb57a3
5 changed files with 106 additions and 44 deletions
+3 -1
View File
@@ -41,6 +41,8 @@ else EOxCloudless; [circuits/photos.json](circuits/photos.json) holds the picks,
layout draw the dark map instead of EOxCloudless. Every picture carries the credit line of its sources at its
bottom and in `X-Credits`, its licence in `X-License` (it follows its sources), and `Link: </licences>; rel="license"`.
An unknown country, locality, circuit or layout, or a year no layout of the circuit covers, is answered 404, naming it.
A race is named as [Jolpica](https://github.com/jolpica/jolpica-f1) (the Ergast API's successor) names it in
its schedule, and its circuit is found by Jolpica's circuit id (`ergastId` in `circuits.json`), never by the
circuit's name: Jolpica renames circuits (Losail became Lusail), the id stays.
@@ -163,7 +165,7 @@ are fetched only when a picture asks for them, at most two at once; Wikimedia Co
`merge-check.sh` runs before a change merges: every Python file the service ships must parse, and the tests in
`tests/` must pass (every circuit has one unique `ergastId`, a race resolves by it, a failed Jolpica fetch is never
kept, every link in this README leads to a file; a poster's satellite source,
kept, every link in this README leads to a file, an unknown circuit or layout is named; a poster's satellite source,
credits and licence, its options, keys and cache headers, and the picture store's cap).
## Acknowledgment