Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
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 ):
...
@@ -1364,10 +1364,10 @@ class CategoryTool( UniqueObject, Folder, Base ):
category_list
.
append
(
"%s/%s"
%
(
base_category
,
relative_url
))
category_list
.
append
(
"%s/%s"
%
(
base_category
,
relative_url
))
search
=
self
.
getPortalObject
().
Base_zSearchRelatedObjectsByCategoryList
search
=
self
.
getPortalObject
().
Base_zSearchRelatedObjectsByCategoryList
result_dict
=
{}
if
local_index_dict
:
if
local_index_dict
:
# For some base categories, lookup indexes in ZODB.
# For some base categories, lookup indexes in ZODB.
recurse
=
isinstance
(
context
,
Category
)
and
not
strict_membership
recurse
=
isinstance
(
context
,
Category
)
and
not
strict_membership
result_dict
=
{}
def
check_local
():
def
check_local
():
r
=
set
(
getattr
(
related
,
base_category
,
()))
r
=
set
(
getattr
(
related
,
base_category
,
()))
r
.
difference_update
(
result_dict
)
r
.
difference_update
(
result_dict
)
...
@@ -1456,26 +1456,18 @@ class CategoryTool( UniqueObject, Folder, Base ):
...
@@ -1456,26 +1456,18 @@ class CategoryTool( UniqueObject, Folder, Base ):
not
portal_type
or
ob
.
getPortalType
()
in
portal_type
)]
not
portal_type
or
ob
.
getPortalType
()
in
portal_type
)]
# Finish with base categories that are only indexed in catalog,
# Finish with base categories that are only indexed in catalog,
# making sure we don't return duplicate values.
# 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
:
else
:
# Catalog-only search.
# Catalog-only search.
result
=
[]
result
=
[]
if
category_list
:
for
r
in
search
(
category_list
=
category_list
,
for
r
in
search
(
category_list
=
category_list
,
portal_type
=
portal_type
,
portal_type
=
portal_type
,
strict_membership
=
strict_membership
):
strict_membership
=
strict_membership
):
try
:
if
r
.
relative_url
not
in
result_dict
:
result
.
append
(
self
.
unrestrictedTraverse
(
r
.
path
))
try
:
except
KeyError
:
result
.
append
(
self
.
unrestrictedTraverse
(
r
.
path
))
pass
except
KeyError
:
pass
if
checked_permission
is
None
:
if
checked_permission
is
None
:
return
result
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