From a7006979a57e67a35f4b9f2ab586351a661e51f0 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Fri, 30 Sep 2005 18:33:50 +0000
Subject: [PATCH] If value is DateTime, call ISO to convert it to a string
 compatible with MySQL.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3929 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Tool/DomainTool.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/product/ERP5/Tool/DomainTool.py b/product/ERP5/Tool/DomainTool.py
index ba61fab3db..954647fc97 100755
--- a/product/ERP5/Tool/DomainTool.py
+++ b/product/ERP5/Tool/DomainTool.py
@@ -37,6 +37,7 @@ from Products.ERP5 import _dtmldir
 from Products.ERP5Type.Tool.BaseTool import BaseTool
 from Products.ERP5Type.Document.Folder import Folder
 from zLOG import LOG
+from DateTime import DateTime
 
 class DomainTool(BaseTool):
     """
@@ -109,6 +110,8 @@ class DomainTool(BaseTool):
             expression += "%s is NULL AND %s_range_min is NULL AND %s_range_max is NULL" \
                                    % ((base_name,)*3)
           else:
+            if isinstance(value, DateTime):
+              value = value.ISO()
             expression = "%s is NULL AND %s_range_min is NULL AND %s_range_max is NULL " % ((base_name,)*3) 
             expression += "OR %s = '%s' " % (base_name,value)
             expression += "OR %s_range_min <= '%s' AND %s_range_max is NULL " \
-- 
2.30.9