From 8375c81a503bd3c2932a1831615f80ca5a5e6b61 Mon Sep 17 00:00:00 2001 From: Mark Brough Date: Wed, 8 Nov 2023 16:55:18 +0100 Subject: [PATCH] Set country codes as withdrawn if specified in the source data --- importers/country.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/importers/country.py b/importers/country.py index 5021048..1141d35 100644 --- a/importers/country.py +++ b/importers/country.py @@ -9,6 +9,7 @@ def run(): ('code', 'code'), ('name_en', 'name_en'), ('name_fr', 'name_fr'), + ('@status', 'status'), ] r = fetch(url) reader = csv.DictReader(r.iter_lines(decode_unicode=True)) @@ -16,11 +17,13 @@ def run(): 'code': x['code'], 'name_en': x['name_en'], 'name_fr': x['name_fr'], + 'status': 'active' if x.get('active') == 'True' else 'withdrawn', } for x in reader] countries.append({ 'code': 'XK', 'name_en': 'Kosovo', 'name_fr': '', + 'status': 'active' }) countries = sorted(countries, key=lambda x: x['name_en']) Importer('Country', 'countries', lookup, source_data=countries)