From 7a5aafed3f4d01701c2347462d39a8bc5ecc736c Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Mon, 14 Dec 2009 17:54:20 -0700 Subject: [PATCH] Add get_path_to_root, so we can create relative links to other objects like css. --- webber.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webber.py b/webber.py index 5cadaaf..f3e0f63 100644 --- a/webber.py +++ b/webber.py @@ -449,6 +449,13 @@ def get_time(): def get_current_file(): return current_file +@set_function("get_path_to_root") +def get_path_to_root(): + rel_path = relpath(directories[current_file.direc].abs_path, directories[''].abs_path) + rel_path = os.path.join(rel_path, os.path.split("")[1]) + if rel_path[-1] == "/": + rel_path = rel_path[:-1] + return rel_path -- 2.39.2