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
Georgios Dagkakis
erp5
Commits
9b022399
Commit
9b022399
authored
Jan 15, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CategoryTool: optimize getCategoryList and getAcquiredCategoryList
parent
dd5ffa73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
product/CMFCategory/CategoryTool.py
product/CMFCategory/CategoryTool.py
+7
-13
No files found.
product/CMFCategory/CategoryTool.py
View file @
9b022399
...
...
@@ -1152,21 +1152,17 @@ class CategoryTool( UniqueObject, Folder, Base ):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCategoryList'
)
def
getCategoryList
(
self
,
context
):
if
getattr
(
aq_base
(
context
),
'categories'
,
_marker
)
is
not
_marker
:
if
isinstance
(
context
.
categories
,
tuple
):
result
=
list
(
context
.
categories
)
elif
isinstance
(
context
.
categories
,
list
):
result
=
context
.
categories
else
:
result
=
[]
result
=
getattr
(
aq_base
(
context
),
'categories'
,
None
)
if
result
is
not
None
:
result
=
list
(
result
)
elif
isinstance
(
context
,
dict
):
re
sult
=
list
(
context
.
get
(
'categories'
,
[]
))
re
turn
list
(
context
.
get
(
'categories'
,
()
))
else
:
result
=
[]
if
getattr
(
context
,
'isCategory'
,
0
):
category_url
=
context
.
getRelativeUrl
()
if
category_url
not
in
result
:
result
.
append
(
c
ontext
.
getRelativeUrl
()
)
# Pure category is member of itself
result
.
append
(
c
ategory_url
)
# Pure category is member of itself
return
result
_getCategoryList
=
getCategoryList
...
...
@@ -1184,12 +1180,10 @@ class CategoryTool( UniqueObject, Folder, Base ):
def
getAcquiredCategoryList
(
self
,
context
):
result
=
self
.
getAcquiredCategoryMembershipList
(
context
,
base_category
=
self
.
getBaseCategoryList
(
context
=
context
))
append
=
result
.
append
non_acquired
=
self
.
_getCategoryList
(
context
)
for
c
in
non_acquired
:
for
c
in
self
.
_getCategoryList
(
context
):
# Make sure all local categories are considered
if
c
not
in
result
:
append
(
c
)
result
.
append
(
c
)
return
result
# Catalog related methods
...
...
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