console/SWSCloudCore/views/kb/__init__.py

19 lines
508 B
Python

# coding: utf-8
from flask import Blueprint, abort, render_template
from SWSCloudCore.controllers.kb import ControllerKB
viewKB = Blueprint('kb', __name__, url_prefix='/kb')
@viewKB.route('/')
@viewKB.route('/<path:document>')
def index(document='README'):
# Check exists document
if not ControllerKB().is_exists(document):
return abort(404)
# Return document
return render_template(
'default/kb/index.html',
kb_markdown=ControllerKB().get(document)
)