Check do_post_sort attribute on source to be able to disable the sorting.
This commit is contained in:
parent
4b42da9439
commit
02a0a792ee
|
@ -5,6 +5,8 @@ Changelog
|
|||
1.0 (unreleased)
|
||||
----------------
|
||||
|
||||
- Check do_post_sort attribute on source to be able to disable the sorting.
|
||||
|
||||
- Declare dependencies on z3c.relationfield and plone.formwidget.contenttree.
|
||||
|
||||
- Remove ploneform-render-widget view for content provider, this is now
|
||||
|
|
|
@ -279,9 +279,12 @@ class AutocompleteSearch(BaseAutocompleteSearch):
|
|||
query = "path:%s %s" % (source.tokenToPath(path), query)
|
||||
|
||||
if query:
|
||||
terms = set(source.search(query))
|
||||
terms = source.search(query)
|
||||
else:
|
||||
terms = set()
|
||||
terms = ()
|
||||
|
||||
if getattr(source, 'do_post_sort', True):
|
||||
terms = sorted(set(terms), key=lambda t: t.title)
|
||||
|
||||
return u'\n'.join([u"|".join((t.token, t.title or t.token, t.portal_type, t.url, t.extra))
|
||||
for t in sorted(terms, key=lambda t: t.title)])
|
||||
for t in terms])
|
||||
|
|
Reference in New Issue