summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2020-12-18 10:32:00 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2020-12-18 10:32:43 +0100
commitc80e8a7f3b2340fbc9ec2e6c35d347af6693a859 (patch)
treed04b2ec3fa1f07fdee3cd884a07d44e996624be9
parentb53e7bd655a1d7e0193e51890faecd57bcf96455 (diff)
tracking: Handle posten events without descriptionHEADmaster
-rwxr-xr-xmodules/tracking.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/tracking.py b/modules/tracking.py
index 779162a..77f5a74 100755
--- a/modules/tracking.py
+++ b/modules/tracking.py
@@ -158,12 +158,15 @@ class PostenModule(TrackingModule):
if not len(eventset):
continue
last = eventset[0]
- desc = last.find('{%s}Description' % ns).text.replace('&lt;', '<').replace('<br/>', ' ')
+ desc = last.find('{%s}Description' % ns).text or ''
+ desc = desc.replace('&lt;', '<').replace('<br/>', ' ')
desc = re.sub(r'<[^>]*?>', '', desc).encode('utf8').strip()
isodate = last.find('{%s}OccuredAtIsoDateTime' % ns).text[:-10]
isodate = datetime.datetime.strptime(isodate, '%Y-%m-%dT%H:%M:%S')
city = last.find('{%s}City' % ns).text
status = last.find('{%s}Status' % ns).text.encode('utf-8')
+ if not desc:
+ desc = status
if city:
desc = '%s (%s)' % (desc, city.encode('utf8'))
date = last.find('{%s}OccuredAtDisplayDate' % ns).text + ' ' + last.find('{%s}OccuredAtDisplayTime' % ns).text