]> oss.titaniummirror.com Git - webber.git/commitdiff
Add get_path_to_root, so we can create relative links to other objects like css.
authorR. Steve McKown <rsmckown@gmail.com>
Tue, 15 Dec 2009 00:54:20 +0000 (17:54 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 15 Dec 2009 01:47:44 +0000 (18:47 -0700)
webber.py

index 5cadaaff6c9736eefc0bc0b52224230972551de2..f3e0f63fec5c57e0d50dc37870d4630869e4c02d 100644 (file)
--- 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