summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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