]> oss.titaniummirror.com Git - webber.git/blobdiff - plugins/hierarchy.py
Fix directories key error in get_path_to_root
[webber.git] / plugins / hierarchy.py
index 5217e242aed73a2f15e8f9d107552534a79b3729..91575561525c25d9f1b35b3ef1a353b078455096 100644 (file)
@@ -72,8 +72,19 @@ def scan_done(params):
                # And now sort by priority. Since Python 2.2 and upwards has stable-sort,
                # this effectively makes a two-dimensional sort.
                _childs[c].sort(key = lambda x: x[0])
-       return
 
+       visited = {}
+       visited[get_file_for("Home")] = True
+       for f in _parent:
+               visited[f] = True
+       for f in files:
+               file = files[f]
+               if not file.has_key("linktitle"):
+                       continue
+               if not visited.has_key(file ):
+                       warning("orphan file '%s'" % f)
+
+       return
        print "_parent:"
        for c in _parent:
                print " ", c, _parent[c]
@@ -197,9 +208,9 @@ def get_recently(page=None, max_items=10):
        def addPage(res, page):
                #print "page:", page
                res.append( (page, get_link_from(orig_page, page)) )
-               if _childs.has_key(page.title):
-                       for c in _childs[page.title]:
-                               addPage(res, get_file_for(c[1]))
+               if _childs.has_key(page):
+                       for c in _childs[page]:
+                               addPage(res, c[1])
        addPage(res, orig_page)
        res.sort(cmp = lambda x,y: cmp(y[0].mtime, x[0].mtime))
        return res[:max_items]