def getGAETimetable(timetable): gaetable = [] modeltable = timetable.table for item in modeltable: gaestop = stops.getGAEStopByModelId(item[1].id) if gaestop != None: gaetable.append(TimetableItem(time=item[0].seconds, stop=gaestop.key)) else: # TODO: decide what to do when there is no proper gaestop object in the datastore return None initialStopEntity = stops.getGAEStopByModelId(timetable.initial[1].id) if initialStopEntity != None: initialStopKey = initialStopEntity.key else: return None return GAETimetables(initstop=initialStopKey, inittime=timetable.initial[0], table=gaetable)
def getGAETimetable(timetable): gaetable = [] modeltable = timetable.table for item in modeltable: gaestop = stops.getGAEStopByModelId(item[1].id) if gaestop != None: gaetable.append( TimetableItem(time=item[0].seconds, stop=gaestop.key)) else: # TODO: decide what to do when there is no proper gaestop object in the datastore return None initialStopEntity = stops.getGAEStopByModelId(timetable.initial[1].id) if initialStopEntity != None: initialStopKey = initialStopEntity.key else: return None return GAETimetables(initstop=initialStopKey, inittime=timetable.initial[0], table=gaetable)
def test(): from gaemodel import timetables from gaemodel import stops modeltt, keys, ids = testCreateTimetable() outString = "" for i in ids: outString += str(stops.getGAEStopByModelId(i)) for k in keys: outString += str(k.get()) gtt = timetables.getGAETimetable(modeltt) gttKey = gtt.put() # outString = None # if gtt != None: # outString = gtt.toTimetable().toXmlString() from gaemodel import transits generictransit = transits.GAETransit() generictransit.ttable = gttKey generictransit.put() return (outString)
def test(): from gaemodel import timetables from gaemodel import stops modeltt, keys, ids = testCreateTimetable() outString = "" for i in ids: outString += str(stops.getGAEStopByModelId(i)) for k in keys: outString += str(k.get()) gtt = timetables.getGAETimetable(modeltt) gttKey = gtt.put() # outString = None # if gtt != None: # outString = gtt.toTimetable().toXmlString() from gaemodel import transits generictransit = transits.GAETransit() generictransit.ttable = gttKey generictransit.put() return outString