From 8c48cb9d69740d71b718ebdbf909499ff33a5a0e Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Thu, 25 Jun 2009 14:53:59 +0200 Subject: [PATCH] hierarchy: fix ordering of menu entries 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 | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/plugins/hierarchy.py b/plugins/hierarchy.py index 837bb41..09fbeae 100644 --- a/plugins/hierarchy.py +++ b/plugins/hierarchy.py @@ -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) -- 2.39.2