Permalink
Browse files

Fixed bug in getting predictions.

  • Loading branch information...
1 parent 09271cb commit 4f2ffbb06205e2342ee74efb38a51a272159a238 cgroskopf committed Jan 11, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 ctabustracker/bustracker.py
@@ -134,7 +134,7 @@ def get_vehicle(self, vehicle_id):
'distance_into_route': float(tag.pdist.string)
}
- if hasattr(tag.dly, 'string') and tag.dly.string == 'true':
+ if tag.find('dly') and tag.dly.string == 'true':
vehicle['delayed'] = True
else:
vehicle['delayed'] = False
@@ -168,7 +168,7 @@ def get_route_vehicles(self, route_id):
'distance_into_route': float(tag.pdist.string)
}
- if hasattr(tag.dly, 'string') and tag.dly.string == 'true':
+ if tag.find('dly') and tag.dly.string == 'true':
vehicles[str(tag.vid.string)]['delayed'] = True
else:
vehicles[str(tag.vid.string)]['delayed'] = False
@@ -377,7 +377,7 @@ def _parse_predictions(self, url):
'prediction': datetime.strptime(tag.prdtm.string, '%Y%m%d %H:%M'),
}
- if hasattr(p.dly, 'string') and p.dly.string == 'true':
+ if tag.find('dly') and tag.dly.string == 'true':
p['delay'] = True
else:
p['delay'] = False

0 comments on commit 4f2ffbb

Please sign in to comment.