edit import_atlas to use Route if routeMapping.json does not contain mapping

This commit is contained in:
Sanj 2012-02-02 19:09:29 +05:30
parent 0e37c60b34
commit 91a25d1f5b

View File

@ -123,12 +123,19 @@ def importUniqueRoutes():
stopMapping = {} #FIXME
stopErrors = [] #This should ideally never happen, and any errors here are bad and would indicate problems with the fuzzy matching logic, most likely.
for route in data.keys():
if routeMapping.has_key(route):
routeCode = routeMapping[route]
try:
routeObj = Route.objects.get(code=routeCode)
except:
routeDoesNotExistErrors.append({'routeCode': routeCode, 'routeAlias': route})
continue
else:
try:
routeObj = Route.objects.get(alias=route)
except:
routeDoesNotExistErrors.append({'routeAlias': route})
for unique_route in data[route]:
thisRoute = unique_route #FIXME
try: