break out of loop if route lookup fails
This commit is contained in:
parent
f3ca42d303
commit
0df365164a
|
@ -135,6 +135,7 @@ def importUniqueRoutes():
|
||||||
routeObj = Route.objects.get(alias=route)
|
routeObj = Route.objects.get(alias=route)
|
||||||
except:
|
except:
|
||||||
routeDoesNotExistErrors.append({'routeAlias': route})
|
routeDoesNotExistErrors.append({'routeAlias': route})
|
||||||
|
continue
|
||||||
|
|
||||||
for unique_route in data[route]:
|
for unique_route in data[route]:
|
||||||
thisRoute = unique_route #FIXME
|
thisRoute = unique_route #FIXME
|
||||||
|
@ -154,6 +155,9 @@ def importUniqueRoutes():
|
||||||
else: #Else we do fuzzy string matching against all possible values for stopname got from RouteDetails
|
else: #Else we do fuzzy string matching against all possible values for stopname got from RouteDetails
|
||||||
stopnames = []
|
stopnames = []
|
||||||
stopcodes = []
|
stopcodes = []
|
||||||
|
if RouteDetail.objects.filter(route=routeObj).count() == 0:
|
||||||
|
routeDoesNotExistErrors.append({'routeDetailDoesNotExist': routeObj.code})
|
||||||
|
continue
|
||||||
for r in RouteDetail.objects.filter(route=routeObj):
|
for r in RouteDetail.objects.filter(route=routeObj):
|
||||||
stopnames.append(r.stop.name)
|
stopnames.append(r.stop.name)
|
||||||
stopcodes.append(r.stop.code)
|
stopcodes.append(r.stop.code)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user