Friday, March 5, 2010

code highlighting

I loop over the result set and create new tasks for the aggregation task queue.

q = db.GqlQuery("SELECT * FROM RouteListing WHERE stopID = :1",stopID)
routeQuery = q.fetch(100)
if len(routeQuery) > 0:
memcache.add(sid, 0)
for r in routeQuery:
counter = memcache.incr(sid)
task = Task(url='/aggregationtask',
params={'sid':sid,
'stop':stopID,
'route':r.route,
'direction':r.direction,
'url':r.scheduleURL,
'caller':caller
})
task.add('aggregation')
else:
# do some error handling

No comments:

Post a Comment