def _find_by_no(self, no): person = Person.find_by_no(no) if not person: return {'status': 'failure', 'reason': 'Person not found.'} result = {'status': 'success', 'person': person} return result
def get(self): person = None if request.args.get('no'): no = int(request.args['no']) person = Person.find_by_no(no) if not person: return {'status': 'failure', 'reason': 'Person not found.'} tree = Person.get_tree(person=person) result = {'status': 'success', 'tree': tree} return jsonify(result)