]> oss.titaniummirror.com Git - webber.git/commitdiff
hierarchy: fix ordering of menu entries
authorHolger Schurig <holgerschurig@gmx.de>
Thu, 25 Jun 2009 12:53:59 +0000 (14:53 +0200)
committerHolger Schurig <holgerschurig@gmx.de>
Thu, 25 Jun 2009 12:53:59 +0000 (14:53 +0200)
Previously the code tried to determine a new "file.order" value by
iterating over all files, looking for the highest order. It then
assigned order+100 to a file which didn't have a an order specified.

This turned out to be a flaw of thinking, because the order in which
files are is non-deterministic.

plugins/hierarchy.py

index 837bb41d52e755b89e3b0e27368e9a93476e8b47..09fbeaea98132d0832ec0a5d8d2eb97351a1dec3 100644 (file)
@@ -21,20 +21,10 @@ def memorize_links(title, links):
                _parent[link] = title
 
 
-def memorize_parent(title, parent, order):
+def memorize_parent(title, parent, order=100):
        #print "memorize_parent:", title, parent
        #print "  parent:", _parent
        #print "  childs:", _childs
-       if order==-1:
-               order = 0
-               if _childs.has_key(parent):
-                       for c in _childs:
-                               for o,n in _childs[c]:
-                                       if o > order:
-                                               order = o
-               else:
-                       _childs[parent] = []
-               order += 100
        #print "order:", title, order
        if not _childs.has_key(parent):
                _childs[parent] = []
@@ -58,7 +48,7 @@ def scan(params):
                if file.has_key("order"):
                        order = int(file.order)
                else:
-                       order = -1
+                       order = 100
                memorize_parent(file.linktitle, file.parent, order)