Added check on sort index
authorThierry Florac <tflorac@ulthar.net>
Wed, 12 Dec 2018 18:01:44 +0100
changeset 1162 d8d05f5c83ba
parent 1161 10bb070ff1d6
child 1163 b15d210297bc
Added check on sort index
src/pyams_content/shared/view/__init__.py
--- a/src/pyams_content/shared/view/__init__.py	Wed Dec 12 17:22:59 2018 +0100
+++ b/src/pyams_content/shared/view/__init__.py	Wed Dec 12 18:01:44 2018 +0100
@@ -132,7 +132,7 @@
             adapter = registry.queryAdapter(self, IViewQuery, name='es')
             if adapter is None:
                 adapter = registry.getAdapter(self, IViewQuery)
-            if sort_index == RELEVANCE_ORDER:
+            if (not sort_index) or (sort_index == RELEVANCE_ORDER):
                 sort_index = None  # keep natural order
             else:
                 sort_index = self.order_by