Commit d9f25447 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use sort_key_method instead of sort_method.

parent 17320c43
...@@ -73,19 +73,15 @@ class RoundingTool(BaseTool): ...@@ -73,19 +73,15 @@ class RoundingTool(BaseTool):
parent_uid_list.append(current_document.getUid()) parent_uid_list.append(current_document.getUid())
current_document = current_document.aq_parent current_document = current_document.aq_parent
def sortMethod(document_a, document_b): context_path = context.getPhysicalPath()
def score(document): def sortKeyMethod(document):
context_path = context.getPhysicalPath() result = 0
result = len(context_path) for a, b in zip(context_path, document.getPhysicalPath()):
for a, b in zip(context_path, if a != b:
document.getPhysicalPath()): break
if a==b: result -= 1
result -= 1 return result
else: kw['sort_key_method'] = sortKeyMethod
break
return result
return cmp(score(document_a), score(document_b))
kw['sort_method'] = sortMethod
result = portal.portal_domains.searchPredicateList( result = portal.portal_domains.searchPredicateList(
context=document, context=document,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment