def get_pulpit(pulpit_id): pulpits = [] for row in return_objects_from_table('pulpits'): pulpit = Pulpit(row[0], row[1], row[2]) pulpits.append(pulpit.jason()) pulpit = filter(lambda p: p['id'] == pulpit_id, pulpits) if not pulpit: return jsonify({'error': 'Not found'}) return jsonify({'pulpit': pulpit[0]})
def get_pulpits(): pulpits = [] for row in return_objects_from_table('pulpits'): pulpit = Pulpit(row[0], row[1], row[2]) pulpits.append(pulpit.jason()) return jsonify({'pulpits': pulpits})