From 551f14795234b21d8633a3229c28bfc55d03b994 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Wed, 11 Jan 2006 09:12:32 +0000
Subject: [PATCH] fixed error when doing sort with Folder.objectValues :
 LazyMap instance has not attribute sort

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5094 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Utils.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py
index aced253a22..285f99f0fa 100755
--- a/product/ERP5Type/Utils.py
+++ b/product/ERP5Type/Utils.py
@@ -38,6 +38,7 @@ from Products.CMFCore.DirectoryView import registerDirectory
 from Products.CMFCore.utils import getToolByName
 from Products.PageTemplates.Expressions import getEngine
 from Products.PageTemplates.Expressions import SecureModuleImporter
+from Products.ZCatalog.Lazy import LazyMap
 
 from Products.ERP5Type import Permissions
 from Products.ERP5Type import Constraint
@@ -116,6 +117,9 @@ def sortValueList(value_list, sort_on=None, sort_order=None, **kw):
           break
       return result
 
+    if isinstance(value_list,LazyMap):
+      new_value_list = [x for x in value_list]
+      value_list = new_value_list
     value_list.sort(sortValues)
     
   return value_list
-- 
2.30.9