Skip to content

Commit

Permalink
Prevent AppCtxGlobals error
Browse files Browse the repository at this point in the history
  • Loading branch information
nik authored and makseq committed Oct 14, 2020
1 parent 47fc8dc commit 31fbd7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion label_studio/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def app_before_request_callback():

@app.after_request
def app_after_request_callback(response):
g.analytics.send(request, session, response)
if hasattr(g, 'analytics'):
g.analytics.send(request, session, response)
return response


Expand Down
2 changes: 1 addition & 1 deletion label_studio/utils/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _prepare_response(self, payload, response):
payload['response'] = r

def _exclude_endpoint(self, request):
if request.endpoint in ('send_static', 'get_data_file'):
if request.endpoint in ('static', 'send_static', 'get_data_file'):
return True
if request.args.get('polling', False):
return True
Expand Down

0 comments on commit 31fbd7e

Please sign in to comment.