# -*- coding: utf-8 -*- ############################################################################### # ScribeEngine - Open Source Content Management System # # --------------------------------------------------------------------------- # # Copyright (c) 2010-2021 Raoul Snyman # # --------------------------------------------------------------------------- # # This file is part of ScribeEngine. # # # # ScribeEngine is free software: you can redistribute it and/or modify it # # under the terms of the GNU General Public License as published by the Free # # Software Foundation, either version 3 of the License, or (at your option) # # any later version. # # # # ScribeEngine is distributed in the hope that it will be useful, but WITHOUT # # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # # more details. # # # # You should have received a copy of the GNU General Public License along # # with ScribeEngine. If not, see . # ############################################################################### """ The :mod:`~scribeengine.views.node` module contains methods that actually render content nodes """ from flask import Blueprint from scribeengine.helpers import render from scribeengine.models import Node node_views = Blueprint('node', __name__, url_prefix='/') @node_views.route('', methods=['GET']) def index(): nodes = Node.query.limit(10).all() return render('/node-list.html', title='ScribeEngine', nodes=[n.complete for n in nodes]) @node_views.route('/node/', methods=['GET']) def view(node_id): node = Node.get(node_id) if not node: return render('/404.html', title='ScribeEngine'), 404 return render('/blog.html', title='ScribeEngine', node=node.complete)