def fetchTasks(cls, startDate, endDate, ancestor, maxResults=100): tasks = Task.query(ancestor=ancestor).filter(Task.date >= startDate).filter(Task.date < endDate).fetch(maxResults) tasksDict = {} for task in tasks: taskDate = utils.api_from_py_date(task.date) if taskDate in tasksDict: tasksDict[taskDate].append(task.simplify()) else: tasksDict[taskDate] = [task.simplify()] return tasksDict
def simplify(self): return {'id':self.key.id(), 'date': utils.api_from_py_date(self.date), 'task': self.task}