From 6e4e1c4cbee53fe8eccca9c97fd9dc7789dc1668 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 25 Oct 2016 22:59:38 +0200 Subject: [PATCH] views/flight: Fix broken "g.current_user" reference --- skylines/frontend/views/flight.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/skylines/frontend/views/flight.py b/skylines/frontend/views/flight.py index ece140add5..7973c76477 100644 --- a/skylines/frontend/views/flight.py +++ b/skylines/frontend/views/flight.py @@ -1,7 +1,7 @@ import math from datetime import datetime -from flask import Blueprint, request, abort, current_app, jsonify, g, make_response +from flask import Blueprint, request, abort, current_app, jsonify, make_response from sqlalchemy import literal_column, and_ from sqlalchemy.orm import undefer_group, contains_eager @@ -45,9 +45,11 @@ def _reanalyse_if_needed(flight): def _patch_query(q): + current_user = User.get(request.user_id) if request.user_id else None + return q.join(Flight.igc_file) \ .options(contains_eager(Flight.igc_file)) \ - .filter(Flight.is_viewable(g.current_user)) + .filter(Flight.is_viewable(current_user)) def _get_flight_path(flight, threshold=0.001, max_points=3000):