diff options
Diffstat (limited to 'apioforum/forum.py')
-rw-r--r-- | apioforum/forum.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/apioforum/forum.py b/apioforum/forum.py index 09d3166..dadc8b3 100644 --- a/apioforum/forum.py +++ b/apioforum/forum.py @@ -11,14 +11,23 @@ from .mdrender import render from sqlite3 import OperationalError -from sqlite3 import OperationalError - bp = Blueprint("forum", __name__, url_prefix="/") @bp.route("/") def not_actual_index(): return redirect("/1") +def forum_path(forum_id): + db = get_db() + i = forum_id + path = [] + while i != None: + forum = db.execute("SELECT * FROM forums WHERE id = ?",(i,)).fetchone() + path.append(forum) + i = forum['parent'] + path.reverse() + return path + @bp.route("/<int:forum_id>") def view_forum(forum_id): db = get_db() |