From eb17261df0b20c924928c9e476246eed662af00b Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 17 Feb 2012 13:34:28 +0530 Subject: [PATCH] import atlas silly error --- chaloBEST/imports/import_atlas.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/chaloBEST/imports/import_atlas.py b/chaloBEST/imports/import_atlas.py index 73389dd..5e11ef1 100644 --- a/chaloBEST/imports/import_atlas.py +++ b/chaloBEST/imports/import_atlas.py @@ -19,7 +19,10 @@ def csvToJSON(): routeNo = a[1].strip() # print a if routeNo != '': - atlasDict[routeNo] = [a] + if atlasDict.has_key(routeNo): + atlasDist[routeNo].append(a) + else: + atlasDict[routeNo] = [a] previousRoute = routeNo else: atlasDict[previousRoute].append(a) @@ -58,7 +61,7 @@ def processJSON(): row[i] = previousRow[i] try: if row[-5].strip() == '': - row[-5] = previousRow[-5] + row[-5] = previousRow[-5] #What is -5 ? except: pdb.set_trace() previousRow = row @@ -238,8 +241,8 @@ def noneInt(val): ''' Passed a route code, it gets stop codes for the first and last stop ''' -def getFromToStopsForRoute(routeId): - routeDetails = RouteDetail.objects.filter(route_code=routeId).order_by('serial') +def getFromToStopsForRoute(route): + routeDetails = RouteDetail.objects.filter(route=route).order_by('serial') if routeDetails.count() == 0: return None fromStop = routeDetails[0].stop