Commit a7006979 authored by Yoshinori Okuji's avatar Yoshinori Okuji

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
parent db89895c
...@@ -37,6 +37,7 @@ from Products.ERP5 import _dtmldir ...@@ -37,6 +37,7 @@ from Products.ERP5 import _dtmldir
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type.Document.Folder import Folder from Products.ERP5Type.Document.Folder import Folder
from zLOG import LOG from zLOG import LOG
from DateTime import DateTime
class DomainTool(BaseTool): class DomainTool(BaseTool):
""" """
...@@ -109,6 +110,8 @@ 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" \ expression += "%s is NULL AND %s_range_min is NULL AND %s_range_max is NULL" \
% ((base_name,)*3) % ((base_name,)*3)
else: 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 = "%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 = '%s' " % (base_name,value)
expression += "OR %s_range_min <= '%s' AND %s_range_max is NULL " \ expression += "OR %s_range_min <= '%s' AND %s_range_max is NULL " \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment