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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
erp5
Commits
5f023071
Commit
5f023071
authored
Dec 05, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Predicate: stop testing category membership as soon as possible
parent
e87d3fa3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
33 deletions
+12
-33
product/ERP5Type/Core/Predicate.py
product/ERP5Type/Core/Predicate.py
+12
-33
No files found.
product/ERP5Type/Core/Predicate.py
View file @
5f023071
...
@@ -147,44 +147,23 @@ class Predicate(XMLObject):
...
@@ -147,44 +147,23 @@ class Predicate(XMLObject):
# (multimembership_criterion_base_category_list,
# (multimembership_criterion_base_category_list,
# membership_criterion_base_category_list,
# membership_criterion_base_category_list,
# self.getMembershipCriterionCategoryList()))
# self.getMembershipCriterionCategoryList()))
membership_criterion_category_list
=
\
self
.
getMembershipCriterionCategoryList
()
if
tested_base_category_list
is
not
None
:
membership_criterion_category_list
=
[
x
for
x
in
\
membership_criterion_category_list
if
x
.
split
(
'/'
,
1
)[
0
]
in
\
tested_base_category_list
]
# Test category memberships. Enable the read-only transaction cache
# Test category memberships. Enable the read-only transaction cache
# because this part is strictly read-only, and context.isMemberOf
# because this part is strictly read-only, and context.isMemberOf
# is very expensive when the category list has many items.
# is very expensive when the category list has many items.
with
readOnlyTransactionCache
():
with
readOnlyTransactionCache
():
for
c
in
membership_criterion_category_list
:
for
c
in
self
.
getMembershipCriterionCategoryList
()
:
bc
=
c
.
split
(
'/'
,
1
)[
0
]
bc
=
c
.
split
(
'/'
,
1
)[
0
]
if
(
bc
not
in
tested_base_category
)
and
\
if
tested_base_category_list
is
None
or
bc
in
tested_base_category_list
:
(
bc
in
multimembership_criterion_base_category_list
):
if
bc
in
multimembership_criterion_base_category_list
:
tested_base_category
[
bc
]
=
1
if
not
context
.
isMemberOf
(
c
,
strict_membership
=
strict_membership
):
elif
(
bc
not
in
tested_base_category
)
and
\
return
0
(
bc
in
membership_criterion_base_category_list
):
elif
bc
in
membership_criterion_base_category_list
and
\
tested_base_category
[
bc
]
=
0
not
tested_base_category
.
get
(
bc
):
if
(
bc
in
multimembership_criterion_base_category_list
):
tested_base_category
[
bc
]
=
\
tested_base_category
[
bc
]
=
tested_base_category
[
bc
]
and
\
context
.
isMemberOf
(
c
,
strict_membership
=
strict_membership
)
context
.
isMemberOf
(
c
,
if
0
in
tested_base_category
.
itervalues
():
strict_membership
=
strict_membership
)
return
0
# LOG('predicate test', 0,
# '%s after multi membership to %s' % \
# (tested_base_category[bc], c))
elif
(
bc
in
membership_criterion_base_category_list
):
tested_base_category
[
bc
]
=
tested_base_category
[
bc
]
or
\
context
.
isMemberOf
(
c
,
strict_membership
=
strict_membership
)
# LOG('predicate test', 0,
# '%s after single membership to %s' % \
# (tested_base_category[bc], c))
result
=
0
not
in
tested_base_category
.
values
()
# LOG('predicate test', 0,
# '%s after category %s ' % (result, tested_base_category.items()))
if
not
result
:
return
result
# Test method calls
# Test method calls
test_method_id_list
=
self
.
getTestMethodIdList
()
test_method_id_list
=
self
.
getTestMethodIdList
()
if
test_method_id_list
is
not
None
:
if
test_method_id_list
is
not
None
:
...
...
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