Changeset - 006f855b4b36
[Not reviewed]
default
0 1 0
Dennis Fink - 10 years ago 2015-07-07 19:20:09
dennis.fink@c3l.lu
Use abort function
1 file changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general)
spaceapi/views.py
Show inline comments
 
from flask import Blueprint, jsonify, render_template
 
from flask import Blueprint, jsonify, render_template, abort
 

	
 
from .auth import httpauth
 
from .active import active_json, reload_json
 
from .utils import request_wants_json
 

	
 
root_views = Blueprint('root', __name__)
 

	
 

	
 
@root_views.route('/')
 
def index():
 
    if request_wants_json():
 
        return jsonify(active_json)
 
    return render_template('index.html', status=active_json)
 

	
 

	
 
@root_views.route('/status.json')
 
def status_json():
 
    return jsonify(active_json)
 

	
 

	
 
@root_views.route('/reload')
 
@httpauth.login_required
 
def reload():
 
    reload_json()
 
    return 200
 
    return abort(200)
0 comments (0 inline, 0 general)