From f57bf4344baec8fd6e127a75b30585ff3142801d Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 28 Jul 2011 18:45:29 +0200 Subject: [PATCH] [mod] conditionnal creation of address informations in the importation from parltrack script --- parltrack/current_meps_json_2_sql.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/parltrack/current_meps_json_2_sql.py b/parltrack/current_meps_json_2_sql.py index f71408c6..0b1933e2 100644 --- a/parltrack/current_meps_json_2_sql.py +++ b/parltrack/current_meps_json_2_sql.py @@ -275,10 +275,13 @@ def manage_mep(mep, mep_json): add_delegations(mep, mep_json.get("Delegations", [])) add_countries(mep, mep_json["Constituencies"]) add_groups(mep, mep_json["Groups"]) - add_addrs(mep, mep_json["Addresses"]) + if mep_json.get("Addresses"): + add_addrs(mep, mep_json["Addresses"]) add_organizations(mep, mep_json.get("Staff", [])) - add_mep_email(mep, mep_json["Mail"]) - add_mep_website(mep, mep_json["Homepage"]) + if mep_json.get("Mail"): + add_mep_email(mep, mep_json["Mail"]) + if mep_json.get("Homepage"): + add_mep_website(mep, mep_json["Homepage"]) add_mep_cv(mep, mep_json.get("CV", [])) print " save mep modifications" mep.save()