From: R. Steve McKown Date: Tue, 15 Dec 2009 00:54:20 +0000 (-0700) Subject: Add get_path_to_root, so we can create relative links to other objects like css. X-Git-Url: https://oss.titaniummirror.com/gitweb?p=oss-web.git;a=commitdiff_plain;h=7a5aafed3f4d01701c2347462d39a8bc5ecc736c Add get_path_to_root, so we can create relative links to other objects like css. --- 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