"""Journal functionality.""" from flask import Blueprint bp = Blueprint('journal_views', __name__, url_prefix='/') @bp.route('/', defaults={'path': 'index'}) @bp.route('/') def display_journal_entry(path): return path def journal_file_resolver(path): """Manipulate the request path to find appropriate journal files. * convert dir requests to index files Worth noting, Flask already does stuff like convert '/foo/../../../bar' to '/bar', so we don't need to take care around file access here. """ if path.endswith('/'): path = f'{path}index' return path