Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
141
Merge Requests
141
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
27eddd73
Commit
27eddd73
authored
May 27, 2019
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
put double quotes if necessary
parent
fb0ecb5f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
product/ZSQLCatalog/Operator/OperatorBase.py
product/ZSQLCatalog/Operator/OperatorBase.py
+12
-3
No files found.
product/ZSQLCatalog/Operator/OperatorBase.py
View file @
27eddd73
...
@@ -34,6 +34,7 @@ from Products.ZSQLCatalog.interfaces.operator import IOperator
...
@@ -34,6 +34,7 @@ from Products.ZSQLCatalog.interfaces.operator import IOperator
from
Products.ZSQLCatalog.Utils
import
sqlquote
as
escapeString
from
Products.ZSQLCatalog.Utils
import
sqlquote
as
escapeString
from
zope.interface.verify
import
verifyClass
from
zope.interface.verify
import
verifyClass
from
zope.interface
import
implements
from
zope.interface
import
implements
import
re
def
valueFloatRenderer
(
value
):
def
valueFloatRenderer
(
value
):
if
isinstance
(
value
,
basestring
):
if
isinstance
(
value
,
basestring
):
...
@@ -65,11 +66,19 @@ value_search_text_renderer = {
...
@@ -65,11 +66,19 @@ value_search_text_renderer = {
DateTime
:
str
,
DateTime
:
str
,
}
}
# Allows all ascii chars except query syntax special chars.
# In other words it forbids operator chars !<=> as first character
# plus forbids any other syntax special chars like : or space.
raw_string_validator_re
=
re
.
compile
(
r"^[#\
$%&
'\
*
\+,\
-
\./0-9;\
?@A-Z
\[\\\
]
\^_`a-z\
{
\|\
}~][!#
\$%&'\
*
\+,\
-
\./0-9;<=>\
?@A-Z
\[\\\
]
\^_`a-z\
{
\|\
}~]*$
")
def valueDefaultSearchTextRenderer(value):
def valueDefaultSearchTextRenderer(value):
"""
"""
This is just repr, but always surrounding text strings with doublequotes.
This is just repr, but always surrounding text strings with doublequotes.
"""
"""
if isinstance(value, basestring):
if isinstance(value, basestring):
if raw_string_validator_re.match(value):
result = value
else:
if value.replace("
\\\\
", "")[-1] == "
\\
":
if value.replace("
\\\\
", "")[-1] == "
\\
":
value = value[:-1]
value = value[:-1]
result = '"
{}
"'.format(value.replace('"', '
\\
"'))
result = '"
{}
"'.format(value.replace('"', '
\\
"'))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment