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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
68de872c
Commit
68de872c
authored
7 years ago
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SelectionTool: asDomainQuery: New method
parent
a75dd0c9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
product/ERP5Form/Tool/SelectionTool.py
product/ERP5Form/Tool/SelectionTool.py
+33
-0
No files found.
product/ERP5Form/Tool/SelectionTool.py
View file @
68de872c
...
...
@@ -46,6 +46,7 @@ from urlparse import urlsplit, urlunsplit
from
zLOG
import
LOG
,
INFO
,
WARNING
from
Acquisition
import
aq_base
from
Products.ERP5Type.Message
import
translateString
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
import
warnings
...
...
@@ -1332,6 +1333,38 @@ class SelectionTool( BaseTool, SimpleItem ):
# Return the search dialog
return
getattr
(
o
,
dialog_id
)(
REQUEST
=
REQUEST
)
security
.
declarePublic
(
'asDomainSelection'
)
def
asDomainQuery
(
self
,
domain
,
strict_membership
=
False
):
if
isinstance
(
domain
,
DomainSelection
):
warnings
.
warn
(
"To pass a DomainSelection instance is deprecated.
\
n
"
"Please use a domain dict instead."
,
DeprecationWarning
)
else
:
domain
=
DomainSelection
(
domain
).
__of__
(
self
)
relation_dict
=
{}
query_list
=
[]
append
=
query_list
.
append
domain_item_dict
=
domain
.
asDomainItemDict
()
# XXX: why even put Nones in domain if they are ignored ?
domain_item_dict
.
pop
(
None
,
None
)
for
key
,
value
in
domain_item_dict
.
iteritems
():
if
getattr
(
aq_base
(
value
),
'isPredicate'
,
0
):
append
(
value
.
asQuery
(
strict_membership
=
strict_membership
),
)
else
:
relation_dict
[
key
]
=
[
value
]
if
relation_dict
:
append
(
self
.
getPortalObject
().
portal_catalog
.
getCategoryValueDictParameterDict
(
relation_dict
,
strict_membership
=
strict_membership
,
),
)
if
query_list
:
return
ComplexQuery
(
query_list
)
return
SimpleQuery
(
uid
=
0
,
comparison_operator
=
'>'
)
security
.
declarePublic
(
'buildSQLJoinExpressionFromDomainSelection'
)
def
buildSQLJoinExpressionFromDomainSelection
(
self
,
selection_domain
,
domain_id
=
None
,
...
...
This diff is collapsed.
Click to expand it.
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