Commit 4a4ba3fe authored by Sebastien Robin's avatar Sebastien Robin

add more brackets

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21976 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2e5870c0
...@@ -109,22 +109,22 @@ class DomainTool(BaseTool): ...@@ -109,22 +109,22 @@ class DomainTool(BaseTool):
# context.getProperty(property)) # context.getProperty(property))
value = context.getProperty(property) value = context.getProperty(property)
format_dict = {'base_name': base_name} format_dict = {'base_name': base_name}
expression = "(%(base_name)s is NULL) AND " \ expression = "((%(base_name)s is NULL) AND " \
"(%(base_name)s_range_min is NULL) AND " \ "(%(base_name)s_range_min is NULL) AND " \
"(%(base_name)s_range_max is NULL)" % format_dict "(%(base_name)s_range_max is NULL))" % format_dict
if value is not None: if value is not None:
# Handle Mysql datetime correctly # Handle Mysql datetime correctly
if isinstance(value, DateTime): if isinstance(value, DateTime):
value = value.toZone('UTC').ISO() value = value.toZone('UTC').ISO()
format_dict['value'] = value format_dict['value'] = value
# Generate expression # Generate expression
expression += "OR (%(base_name)s = '%(value)s') " \ expression += " OR (%(base_name)s = '%(value)s') " \
"OR (%(base_name)s_range_min <= '%(value)s') AND " \ "OR ((%(base_name)s_range_min <= '%(value)s') AND " \
"(%(base_name)s_range_max is NULL) " \ "(%(base_name)s_range_max is NULL)) " \
"OR (%(base_name)s_range_min is NULL) AND " \ "OR ((%(base_name)s_range_min is NULL) AND " \
"%(base_name)s_range_max > '%(value)s' " \ "%(base_name)s_range_max > '%(value)s)' " \
"OR (%(base_name)s_range_min <= '%(value)s') AND " \ "OR ((%(base_name)s_range_min <= '%(value)s') AND " \
"%(base_name)s_range_max > '%(value)s' " \ "%(base_name)s_range_max > '%(value)s)' " \
% format_dict % format_dict
expression = '( %s )' % expression expression = '( %s )' % expression
expression_list.append(expression) expression_list.append(expression)
......
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