diff options
Diffstat (limited to 'modules/tracking.py')
-rwxr-xr-x | modules/tracking.py | 5 |
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('<', '<').replace('<br/>', ' ') + desc = last.find('{%s}Description' % ns).text or '' + desc = desc.replace('<', '<').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 |