def task(id): current_app.logger.info("[GET] /tasks/{0}".format(id)) tasks = task_model(); task = tasks.get(id) #return jsonify(task=task) return current_app.response_class(json.dumps(task.as_dict(), indent=None if request.is_xhr else 2), mimetype='application/json')
def tasks(): current_app.logger.info("[GET] /tasks") tasks = [(t.as_dict()) for t in task_model().itervalues()] #return jsonify(tasks=tasks) #return make_response(json.dumps(tasks, indent=None if request.is_xhr else 2), mimetype='application/json') return current_app.response_class(json.dumps(tasks, indent=None if request.is_xhr else 2), mimetype='application/json')
def mock_tasks(): tasks = task_model() # id=0, text="", priority="Normal", project="", due=date.today(), status="Not started", link="" tasks[100] = Task(100, "Analyse dependants", "Normal", "vie2011", date(2013, 03, 01), "Not started", "") tasks[101] = Task(101, "Rosterplus error", "Normal", "yar2010", date(2013, 04, 01), "Not started", "") tasks[102] = Task(102, "Overtime 5110", "Low", "nsb2012", date(2013, 03, 10), "Not started", "") tasks[103] = Task(103, "Resume pour absence export", "High", "fly2010", date(2013, 03, 11), "In progress", "") tasks[104] = Task(104, "Vehicle assignment - should consider last assigned place", "Normal", "nsb2012", date(2013, 04, 01), "Not started", "") tasks[105] = Task(105, "SWER quand on entre un record en overlap dans einfo01", "Low", "nsb2012", date(2013, 05, 01), "Not started", "")