def list_reports(employee_id=None, status=None): query = Query(kind='Expense Report') if employee_id is not None: key = Key('Employee', employee_id) query.ancestor = key if status is not None: query.add_filter('status', '=', status) for report in query.fetch(): yield _report_info(report)
def _fetch_report_items(report): query = Query(kind='Expense Item') query.ancestor = report.key for item in query.fetch(): yield item
def _fetch_reports(employee): query = Query(kind='Expense Report') query.ancestor = employee.key for item in query.fetch(): yield item