From 4537e96d8aba2ba756cba2f342fefcfa3090c1a3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 17 May 2021 11:46:31 +0100 Subject: [PATCH] Use modified city --- webapp_utils.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/webapp_utils.py b/webapp_utils.py index 25fc7351a..e2fe92b97 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -720,6 +720,24 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str, if not actorJson: return htmlStr + cityMarkup = '' + if city: + city = city.lower().title() + addComma = '' + countryMarkup = '' + if ',' in city: + country = city.split(',', 1)[1].strip().title() + city = city.split(',', 1)[0] + countryMarkup = \ + ' "addressCountry": "' + country + '"\n' + addComma = ',' + cityMarkup = \ + ' "address": {\n' + \ + ' "@type": "PostalAddress",\n' + \ + ' "addressLocality": "' + city + '"' + addComma + '\n' + \ + countryMarkup + \ + ' },\n' + skillsMarkup = '' if actorJson.get('hasOccupation'): if isinstance(actorJson['hasOccupation'], list): @@ -793,23 +811,6 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str, firstEntry = False skillsMarkup += '\n ],\n' - cityMarkup = '' - if city: - city = city.lower().title() - addComma = '' - countryMarkup = '' - if ',' in city: - country = city.split(',', 1)[1].strip().title() - city = city.split(',', 1)[0] - countryMarkup = \ - ' "addressCountry": "' + country + '"\n' - addComma = ',' - cityMarkup = \ - ' "address": {\n' + \ - ' "@type": "PostalAddress",\n' + \ - ' "addressLocality": "' + city + '"' + addComma + '\n' + \ - countryMarkup + \ - ' },\n' description = removeHtml(actorJson['summary']) nameStr = removeHtml(actorJson['name']) personMarkup = \