From f9012cd94808eb4555ed4a26d72d203855719d3f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 27 Jul 2021 20:23:55 +0100 Subject: [PATCH] Optional location --- webapp_search.py | 10 ++++++---- webapp_timeline.py | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/webapp_search.py b/webapp_search.py index 0001f8e2d..bc80379a6 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -108,8 +108,9 @@ def _matchSharedItem(searchStrLowerList: [], """ for searchSubstr in searchStrLowerList: searchSubstr = searchSubstr.strip() - if searchSubstr in sharedItem['location'].lower(): - return True + if sharedItem.get('location'): + if searchSubstr in sharedItem['location'].lower(): + return True elif searchSubstr in sharedItem['summary'].lower(): return True elif searchSubstr in sharedItem['displayName'].lower(): @@ -143,8 +144,9 @@ def _htmlSearchResultShare(sharedItem: {}, translate: {}, '' + translate['Type'] + ': ' + sharedItem['itemType'] + ' ' sharedItemsForm += \ '' + translate['Category'] + ': ' + sharedItem['category'] + ' ' - sharedItemsForm += \ - '' + translate['Location'] + ': ' + sharedItem['location'] + if sharedItem.get('location'): + sharedItemsForm += \ + '' + translate['Location'] + ': ' + sharedItem['location'] if sharedItem.get('itemPrice') and \ sharedItem.get('itemCurrency'): if isfloat(sharedItem['itemPrice']): diff --git a/webapp_timeline.py b/webapp_timeline.py index 918f02fff..e96c2da0f 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -833,8 +833,9 @@ def htmlIndividualShare(actor: str, item: {}, translate: {}, '' + translate['Type'] + ': ' + item['itemType'] + ' ' profileStr += \ '' + translate['Category'] + ': ' + item['category'] + ' ' - profileStr += \ - '' + translate['Location'] + ': ' + item['location'] + if item.get('location'): + profileStr += \ + '' + translate['Location'] + ': ' + item['location'] if item.get('itemPrice') and item.get('itemCurrency'): if isfloat(item['itemPrice']): if float(item['itemPrice']) > 0: