def status_handler(task_id): # status = nosetests.delay() #@UndefinedVariable task = MyAsyncResult(task_id) # @UndefinedVariable result = task.load_meta() offset = bottle.request.query.get('s') if offset and result and result.logs: last = int(offset) - (result.tip or 0) # it should be negative result.logs[:] = result.logs[last:] if last else [] value = task.result if task.successful() else None bottle.response.add_header('Cache-Control', 'no-cache') return dict(status=task.status, value=value, result=result, traceback=task.traceback)