You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
633 B

14 years ago
from flask.blueprints import Blueprint
from flask.helpers import url_for
from werkzeug.utils import redirect
14 years ago
api = Blueprint('api', __name__)
13 years ago
api_docs = {}
api_docs_missing = []
13 years ago
def addApiView(route, func, static = False, docs = None):
api.add_url_rule(route + ('' if static else '/'), endpoint = route.replace('.', '::') if route else 'index', view_func = func)
if docs:
api_docs[route[4:] if route[0:4] == 'api.' else route] = docs
else:
api_docs_missing.append(route)
14 years ago
""" Api view """
def index():
index_url = url_for('web.index')
return redirect(index_url + 'docs/')
14 years ago
addApiView('', index)