From 974a81d4650cfd995bb2eba7d94cb529d18395dc Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Fri, 21 Oct 2005 18:53:56 +0000
Subject: [PATCH] Make sure that value_item is a string before applying
 sql_quote.

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

diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py
index d5a49a26a9..66368501a6 100755
--- a/product/ZSQLCatalog/SQLCatalog.py
+++ b/product/ZSQLCatalog/SQLCatalog.py
@@ -1421,17 +1421,17 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
                     query_item += ["%s = %s" % (key, value_item)]
                   else:
                     # For security.
-                    value_item = sql_quote(value_item)
+                    value_item = sql_quote(str(value_item))
                     if '%' in value_item:
-                      query_item += ["%s LIKE '%s'" % (key, str(value_item))]
+                      query_item += ["%s LIKE '%s'" % (key, value_item)]
                     elif key in keyword_search_keys:
                       # We must add % in the request to simulate the catalog
-                      query_item += ["%s LIKE '%%%s%%'" % (key, str(value_item))]
+                      query_item += ["%s LIKE '%%%s%%'" % (key, value_item)]
                     elif key in full_text_search_keys:
                       # We must add % in the request to simulate the catalog
                       query_item +=  ["MATCH %s AGAINST ('%s')" % (key, value)]
                     else:
-                      query_item += ["%s = '%s'" % (key, str(value_item))]
+                      query_item += ["%s = '%s'" % (key, value_item)]
               if len(query_item) > 0:
                 where_expression += ['(%s)' % join(query_item, ' OR ')]
             elif type(value) is type({}):
-- 
2.30.9