if station ID is not found, try to look for it as a name and take the first result

It is possible to do both:

traveloob> departures 2656@voyagessncf 2128@voyagessncf

and:

traveloob> departures paris lyon
This commit is contained in:
Romain Bignon 2014-01-14 23:21:31 +01:00
commit b319b92a15

View file

@ -104,6 +104,10 @@ class VoyagesSNCFBackend(BaseBackend, ICapTravel):
station = self.STATIONS[int(station_id)]
arrival = self.STATIONS[int(arrival_id)]
except (IndexError, ValueError):
try:
station = list(self.iter_station_search(station_id))[0].name
arrival = list(self.iter_station_search(arrival_id))[0].name
except IndexError:
raise UserError('Unknown station')
with self.browser: