Commit 5a4593b3 authored by Yusei Tahara's avatar Yusei Tahara

Improve wiki successor/predecessor.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19321 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cfa6c8f5
...@@ -567,11 +567,7 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin): ...@@ -567,11 +567,7 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin):
pass pass
reference_list = [r[1] for r in self.getSearchableReferenceList()] reference_list = [r[1] for r in self.getSearchableReferenceList()]
successor_list = self.Base_getImplicitSuccessorValueList(reference_list) result = self.Base_getImplicitSuccessorValueList(reference_list)
# get unique latest (most relevant) versions
temp_result = [r.getObject().getLatestVersionValue() for r in successor_list]
result_dict = dict.fromkeys(temp_result)
result = result_dict.keys()
tv[cache_key] = result tv[cache_key] = result
return result return result
...@@ -604,15 +600,7 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin): ...@@ -604,15 +600,7 @@ class Document(XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin):
method = self._getTypeBasedMethod('getImplicitPredecessorValueList', method = self._getTypeBasedMethod('getImplicitPredecessorValueList',
fallback_script_id = 'Base_getImplicitPredecessorValueList') fallback_script_id = 'Base_getImplicitPredecessorValueList')
lst = method() result = method()
# make it unique first time (before getting lastversionvalue)
di = dict.fromkeys([r.getObject() for r in lst])
# then get latest version and make unique again
di = dict.fromkeys([o.getLatestVersionValue()
for o in di.keys()
if getattr(o, 'getLatestVersionValue', None)])
ref = self.getReference()
result = [o for o in di.keys() if o.getReference() != ref] # every object has its own reference in SearchableText
tv[cache_key] = result tv[cache_key] = result
return result return result
......
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