From 194a08c11c25aa67b61913162467c5b4cc50a986 Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Tue, 28 Feb 2012 13:08:53 -0800 Subject: [PATCH] Actually report missing routes. --- smsBEST/mumbai/app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/smsBEST/mumbai/app.py b/smsBEST/mumbai/app.py index a7b067e..b8c0bbd 100644 --- a/smsBEST/mumbai/app.py +++ b/smsBEST/mumbai/app.py @@ -22,11 +22,11 @@ class App(AppBase): def handle(self, msg): if DIGIT.search(msg.text): routes = ChaloBest.routes(q=msg.text.replace(" ", "")) - detail = ChaloBest.route[routes[0]] - stops = detail['stops']['features'] - if not stops: + if not routes: msg.respond("Sorry, we found no route marked '%s'." % msg.text) return + detail = ChaloBest.route[routes[0]] + stops = detail['stops']['features'] origin, dest = stops[0]['properties'], stops[-1]['properties'] origin_name, dest_name = origin['display_name'], dest['display_name'] origin_area, dest_area = PUNCT.sub('', origin['area']), PUNCT.sub('', dest['area'])