Fix: NoneType.upper() Fehler bei country_code=None im Geoparsing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -60,7 +60,7 @@ def _geocode_offline(name: str, country_code: str = "") -> Optional[dict]:
|
|||||||
if matches:
|
if matches:
|
||||||
# Disambiguierung: country_code bevorzugen, dann Population
|
# Disambiguierung: country_code bevorzugen, dann Population
|
||||||
if country_code:
|
if country_code:
|
||||||
cc_matches = [c for c in matches if c.get("countrycode", "").upper() == country_code.upper()]
|
cc_matches = [c for c in matches if c.get("countrycode", "").upper() == (country_code or "").upper()]
|
||||||
if cc_matches:
|
if cc_matches:
|
||||||
matches = cc_matches
|
matches = cc_matches
|
||||||
best = max(matches, key=lambda c: c.get("population", 0))
|
best = max(matches, key=lambda c: c.get("population", 0))
|
||||||
@@ -95,7 +95,7 @@ def _geocode_location(name: str, country_code: str = "", haiku_coords: Optional[
|
|||||||
country_code: ISO-2 Code (von Haiku)
|
country_code: ISO-2 Code (von Haiku)
|
||||||
haiku_coords: {"lat": float, "lon": float} (Fallback von Haiku)
|
haiku_coords: {"lat": float, "lon": float} (Fallback von Haiku)
|
||||||
"""
|
"""
|
||||||
cache_key = f"{name.lower().strip()}|{country_code.upper()}"
|
cache_key = f"{name.lower().strip()}|{(country_code or '').upper()}"
|
||||||
if cache_key in _geocode_cache:
|
if cache_key in _geocode_cache:
|
||||||
return _geocode_cache[cache_key]
|
return _geocode_cache[cache_key]
|
||||||
|
|
||||||
|
|||||||
In neuem Issue referenzieren
Einen Benutzer sperren