]> oss.titaniummirror.com Git - oss-web.git/blobdiff - webber.py
link: guard against "pages" without link-titles (e.g. graphics files)
[oss-web.git] / webber.py
index abb13d474004e1d8242c7232fa360a88917c4cc3..db3ea7e3af444fdf20d1e5baef8a7d6a677bdb68 100644 (file)
--- a/webber.py
+++ b/webber.py
@@ -188,11 +188,16 @@ def relpath(base_path, target):
 
 def get_link_from(source, dest):
        #print "get_link_from", source, dest
-       source = get_file_for(source)
+       #print source
+       if not isinstance(source, File):
+               source = get_file_for(source)
        if not source:
+               print "NO SOURCE"
                return "."
-       dest = get_file_for(dest)
+       if not isinstance(dest, File):
+               dest = get_file_for(dest)
        if not dest:
+               print "NO DEST"
                return "."
        rel_path = relpath(directories[source.direc].abs_path, directories[dest.direc].abs_path)
        try:
@@ -417,6 +422,10 @@ def iso_to_time(val):
 def format_date(timestamp):
        return time.strftime(cfg.date_format, time.localtime(timestamp))
 
+@set_function("get_time")
+def get_time():
+       return format_date(time.time())
+
 @set_function("get_current_file")
 def get_current_file():
        return current_file