]> oss.titaniummirror.com Git - webber.git/commitdiff
plugins/hierarchy: warn about orphan files
authorHolger Schurig <holgerschurig@gmail.com>
Thu, 13 Jan 2011 11:35:33 +0000 (12:35 +0100)
committerHolger Schurig <holgerschurig@gmail.com>
Thu, 13 Jan 2011 11:35:33 +0000 (12:35 +0100)
Once all files are scanned, warn about files which don't have
a parent.

plugins/hierarchy.py

index 5217e242aed73a2f15e8f9d107552534a79b3729..01994ac5a82187caa663052db10c3fd04369d3ba 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]