From 20f90e6792c40154bc67acfccaf59ce63f1519cf Mon Sep 17 00:00:00 2001 From: Okhin Date: Wed, 31 May 2017 16:01:38 +0200 Subject: [PATCH 1/2] using a placeholder Birth in case its missing in representatives --- .../contrib/parltrack/import_representatives.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/representatives/contrib/parltrack/import_representatives.py b/src/representatives/contrib/parltrack/import_representatives.py index bd8c9f8..456df17 100644 --- a/src/representatives/contrib/parltrack/import_representatives.py +++ b/src/representatives/contrib/parltrack/import_representatives.py @@ -91,6 +91,11 @@ class ParltrackImporter(GenericImporter): return changed = False + # Issue 185. We must have a Birth date for our mep, to allow import + # and slugifying stuff. + if not "Birth" in mep_json: + mep_json["Birth"] = {"date": "9999-01-01T00:00:00", "place":""} + slug = slugify('%s-%s' % ( mep_json["Name"]["full"] if 'full' in mep_json["Name"] else mep_json["Name"]["sur"] + " " + mep_json["Name"]["family"], -- GitLab From b64303b46d7d724ce27e3627073283671b61157c Mon Sep 17 00:00:00 2001 From: Okhin Date: Wed, 31 May 2017 16:14:14 +0200 Subject: [PATCH 2/2] fixing the qa --- .../contrib/parltrack/import_representatives.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/representatives/contrib/parltrack/import_representatives.py b/src/representatives/contrib/parltrack/import_representatives.py index 456df17..d0f5e70 100644 --- a/src/representatives/contrib/parltrack/import_representatives.py +++ b/src/representatives/contrib/parltrack/import_representatives.py @@ -93,8 +93,8 @@ class ParltrackImporter(GenericImporter): changed = False # Issue 185. We must have a Birth date for our mep, to allow import # and slugifying stuff. - if not "Birth" in mep_json: - mep_json["Birth"] = {"date": "9999-01-01T00:00:00", "place":""} + if "Birth" not in mep_json: + mep_json["Birth"] = {"date": "9999-01-01T00:00:00", "place": ""} slug = slugify('%s-%s' % ( mep_json["Name"]["full"] if 'full' in mep_json["Name"] -- GitLab