From bfac1fbf30a4019af63e9a3bfdc1a01f1ae6910d Mon Sep 17 00:00:00 2001
From: Nicolas Wavrant <nicolas.wavrant@nexedi.com>
Date: Thu, 28 Sep 2017 16:28:05 +0200
Subject: [PATCH] SQLCatalog: allow "desc" as a sort keyword

Some listboxes in ERP5 use "| desc" to sort elements, even if it
didn't work (ie: Base_viewEventList/listbox).
Also, as "asc" is working (because descending sort is defined by
whitelist), adding "desc" makes things more consistent
---
 product/ZSQLCatalog/SQLCatalog.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py
index 114603f6ae..9e5e8ffb79 100644
--- a/product/ZSQLCatalog/SQLCatalog.py
+++ b/product/ZSQLCatalog/SQLCatalog.py
@@ -2348,7 +2348,7 @@ class Catalog(Folder,
         if sort_order is not None and len(item) == 1:
           item.append(sort_order)
         if len(item) > 1:
-          if item[1] in ('descending', 'reverse', 'DESC'):
+          if item[1] in ('descending', 'reverse', 'desc', 'DESC'):
             item[1] = 'DESC'
           else:
             item[1] = 'ASC'
-- 
2.30.9