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
Léo-Paul Géneau
erp5
Commits
d8dfa6c7
Commit
d8dfa6c7
authored
Jun 11, 2017
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CategoryTool: Factorise out-of-ZODB related object lookup
To prepare for extension.
parent
87ab190b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
product/CMFCategory/CategoryTool.py
product/CMFCategory/CategoryTool.py
+7
-15
No files found.
product/CMFCategory/CategoryTool.py
View file @
d8dfa6c7
...
...
@@ -1364,10 +1364,10 @@ class CategoryTool( UniqueObject, Folder, Base ):
category_list
.
append
(
"%s/%s"
%
(
base_category
,
relative_url
))
search
=
self
.
getPortalObject
().
Base_zSearchRelatedObjectsByCategoryList
result_dict
=
{}
if
local_index_dict
:
# For some base categories, lookup indexes in ZODB.
recurse
=
isinstance
(
context
,
Category
)
and
not
strict_membership
result_dict
=
{}
def
check_local
():
r
=
set
(
getattr
(
related
,
base_category
,
()))
r
.
difference_update
(
result_dict
)
...
...
@@ -1456,26 +1456,18 @@ class CategoryTool( UniqueObject, Folder, Base ):
not
portal_type
or
ob
.
getPortalType
()
in
portal_type
)]
# Finish with base categories that are only indexed in catalog,
# making sure we don't return duplicate values.
if
category_list
:
for
r
in
search
(
category_list
=
category_list
,
portal_type
=
portal_type
,
strict_membership
=
strict_membership
):
if
r
.
relative_url
not
in
result_dict
:
try
:
result
.
append
(
self
.
unrestrictedTraverse
(
r
.
path
))
except
KeyError
:
pass
else
:
# Catalog-only search.
result
=
[]
if
category_list
:
for
r
in
search
(
category_list
=
category_list
,
portal_type
=
portal_type
,
strict_membership
=
strict_membership
):
try
:
result
.
append
(
self
.
unrestrictedTraverse
(
r
.
path
))
except
KeyError
:
pass
if
r
.
relative_url
not
in
result_dict
:
try
:
result
.
append
(
self
.
unrestrictedTraverse
(
r
.
path
))
except
KeyError
:
pass
if
checked_permission
is
None
:
return
result
...
...
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