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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
60f94952
Commit
60f94952
authored
Oct 17, 2013
by
Vincent Pelletier
Committed by
Julien Muchembled
Oct 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZSQLCatalog: add support for NULL value in SearchText parsing
parent
cb73785f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
product/ZSQLCatalog/SearchText/AdvancedSearchTextParser.py
product/ZSQLCatalog/SearchText/AdvancedSearchTextParser.py
+3
-1
product/ZSQLCatalog/SearchText/__init__.py
product/ZSQLCatalog/SearchText/__init__.py
+2
-2
product/ZSQLCatalog/SearchText/lexer.py
product/ZSQLCatalog/SearchText/lexer.py
+8
-1
No files found.
product/ZSQLCatalog/SearchText/AdvancedSearchTextParser.py
View file @
60f94952
...
@@ -264,7 +264,9 @@ class AdvancedSearchTextParser(lexer):
...
@@ -264,7 +264,9 @@ class AdvancedSearchTextParser(lexer):
def
p_value
(
self
,
p
):
def
p_value
(
self
,
p
):
'''value : OPERATOR string
'''value : OPERATOR string
| string'''
| OPERATOR NULL
| string
| NULL'''
if
len
(
p
)
==
2
:
if
len
(
p
)
==
2
:
p
[
0
]
=
ValueNode
(
p
[
1
])
p
[
0
]
=
ValueNode
(
p
[
1
])
else
:
else
:
...
...
product/ZSQLCatalog/SearchText/__init__.py
View file @
60f94952
from
SearchTextParser
import
parse
,
isAdvancedSearchText
from
SearchTextParser
import
parse
,
isAdvancedSearchText
def
dequote
(
value
):
def
dequote
(
value
):
assert
isinstance
(
value
,
basestring
),
value
if
isinstance
(
value
,
basestring
)
and
len
(
value
)
>=
2
and
\
if
len
(
value
)
>=
2
and
value
[
0
]
==
value
[
-
1
]
==
'"'
and
value
[
-
2
]
!=
'
\
\
'
:
value
[
0
]
==
value
[
-
1
]
==
'"'
and
value
[
-
2
]
!=
'
\
\
'
:
escaped
=
False
escaped
=
False
value_list
=
[]
value_list
=
[]
append
=
value_list
.
append
append
=
value_list
.
append
...
...
product/ZSQLCatalog/SearchText/lexer.py
View file @
60f94952
...
@@ -82,7 +82,9 @@ class lexer(object):
...
@@ -82,7 +82,9 @@ class lexer(object):
'WORD'
,
'WORD'
,
'OPERATOR'
,
'OPERATOR'
,
'LEFT_PARENTHESE'
,
'LEFT_PARENTHESE'
,
'RIGHT_PARENTHESE'
)
'RIGHT_PARENTHESE'
,
'NULL'
,
)
t_ignore
=
' '
t_ignore
=
' '
...
@@ -123,6 +125,11 @@ class lexer(object):
...
@@ -123,6 +125,11 @@ class lexer(object):
r'[^><= :
\
(
\
)"
][
^
:
\
(
\
)
"]*'
r'[^><= :
\
(
\
)"
][
^
:
\
(
\
)
"]*'
return t
return t
def t_NULL(self, t):
r'NULL'
t.value = None
return t
def parse(self, *args, **kw):
def parse(self, *args, **kw):
kw['lexer'] = self
kw['lexer'] = self
return self.parser.parse(*args, **kw)
return self.parser.parse(*args, **kw)
...
...
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