def read(): current_user = User.get(request.user_id) if not current_user: return jsonify(error='invalid-token'), 401 schema = CurrentUserSchema(exclude=('id')) return jsonify(schema.dump(current_user).data)
def read(user_id): user = get_requested_record(User, user_id) user_schema = CurrentUserSchema() if user_id == request.user_id else UserSchema() user_json = user_schema.dump(user).data if request.user_id: current_user = User.get(request.user_id) user_json["followed"] = current_user.follows(user) if "extended" in request.args: user_json["distanceFlights"] = _distance_flights(user) user_json["stats"] = _quick_stats(user) user_json["takeoffLocations"] = _get_takeoff_locations(user) mark_user_notifications_read(user) return jsonify(user_json)
def read(user_id): user = get_requested_record(User, user_id) user_schema = CurrentUserSchema( ) if user_id == request.user_id else UserSchema() user_json = user_schema.dump(user).data if request.user_id: current_user = User.get(request.user_id) user_json["followed"] = current_user.follows(user) if "extended" in request.args: user_json["distanceFlights"] = _distance_flights(user) user_json["stats"] = _quick_stats(user) user_json["takeoffLocations"] = _get_takeoff_locations(user) mark_user_notifications_read(user) return jsonify(user_json)
def index(): if 'application/json' in request.headers.get('Accept', ''): user_schema = CurrentUserSchema( ) if g.user == g.current_user else UserSchema() user = user_schema.dump(g.user).data if g.current_user: user['followed'] = g.current_user.follows(g.user) if 'extended' in request.args: user['distanceFlights'] = _distance_flights(g.user) user['stats'] = _quick_stats() user['takeoffLocations'] = _get_takeoff_locations() return jsonify(**user) mark_user_notifications_read(g.user) return render_template('ember-page.jinja', openlayers=True, active_page='settings')
def index(): if 'application/json' not in request.headers.get('Accept', ''): return redirect(url_for('.profile', user=g.user_id)) schema = CurrentUserSchema(exclude=('id')) return jsonify(**schema.dump(g.user).data)