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 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. 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(): for route in data.keys():
if routeMapping.has_key(route):
routeCode = routeMapping[route] routeCode = routeMapping[route]
try: try:
routeObj = Route.objects.get(code=routeCode) routeObj = Route.objects.get(code=routeCode)
except: except:
routeDoesNotExistErrors.append({'routeCode': routeCode, 'routeAlias': route}) routeDoesNotExistErrors.append({'routeCode': routeCode, 'routeAlias': route})
continue continue
else:
try:
routeObj = Route.objects.get(alias=route)
except:
routeDoesNotExistErrors.append({'routeAlias': route})
for unique_route in data[route]: for unique_route in data[route]:
thisRoute = unique_route #FIXME thisRoute = unique_route #FIXME
try: try: