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
Alain Takoudjou
erp5
Commits
20a82576
Commit
20a82576
authored
Jan 15, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CategoryTool: remove ancient _cleanupCategories migration method
parent
538dd366
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
41 deletions
+8
-41
product/CMFCategory/CategoryTool.py
product/CMFCategory/CategoryTool.py
+3
-32
product/ERP5/tests/testResource.py
product/ERP5/tests/testResource.py
+5
-6
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+0
-3
No files found.
product/CMFCategory/CategoryTool.py
View file @
20a82576
...
...
@@ -627,8 +627,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
portal_type
=
(
portal_type
,)
spec
=
portal_type
self
.
_cleanupCategories
(
context
)
if
isinstance
(
category_list
,
str
):
category_list
=
(
category_list
,
)
elif
category_list
is
None
:
...
...
@@ -705,7 +703,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
to filter the object on
"""
self
.
_cleanupCategories
(
context
)
if
isinstance
(
default_category
,
(
tuple
,
list
)):
default_category
=
default_category
[
0
]
category_list
=
self
.
getCategoryMembershipList
(
context
,
base_category
,
...
...
@@ -1148,18 +1145,13 @@ class CategoryTool( UniqueObject, Folder, Base ):
"""
if
getattr
(
aq_base
(
context
),
'isCategory'
,
0
):
return
context
.
isAcquiredMemberOf
(
category
)
for
c
in
self
.
_
getAcquiredCategoryList
(
context
):
for
c
in
self
.
getAcquiredCategoryList
(
context
):
if
c
.
find
(
category
)
>=
0
:
return
1
return
0
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getCategoryList'
)
def
getCategoryList
(
self
,
context
):
self
.
_cleanupCategories
(
context
)
return
self
.
_getCategoryList
(
context
)
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
)
...
...
@@ -1177,6 +1169,8 @@ class CategoryTool( UniqueObject, Folder, Base ):
result
.
append
(
context
.
getRelativeUrl
())
# Pure category is member of itself
return
result
_getCategoryList
=
getCategoryList
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setCategoryList'
)
def
setCategoryList
(
self
,
context
,
value
):
self
.
_setCategoryList
(
context
,
value
)
...
...
@@ -1188,14 +1182,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getAcquiredCategoryList'
)
def
getAcquiredCategoryList
(
self
,
context
):
"""
Returns the list of acquired categories
"""
self
.
_cleanupCategories
(
context
)
return
self
.
_getAcquiredCategoryList
(
context
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'_getAcquiredCategoryList'
)
def
_getAcquiredCategoryList
(
self
,
context
):
result
=
self
.
getAcquiredCategoryMembershipList
(
context
,
base_category
=
self
.
getBaseCategoryList
(
context
=
context
))
append
=
result
.
append
...
...
@@ -1208,21 +1194,6 @@ class CategoryTool( UniqueObject, Folder, Base ):
append
(
context
.
getRelativeUrl
())
# Pure category is member of itself
return
result
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'_cleanupCategories'
)
def
_cleanupCategories
(
self
,
context
):
# Make sure _cleanupCategories does not modify objects each time it is called
# or we get many conflicts
requires_update
=
0
categories
=
[]
append
=
categories
.
append
if
getattr
(
context
,
'categories'
,
_marker
)
is
not
_marker
:
for
cat
in
self
.
_getCategoryList
(
context
):
if
isinstance
(
cat
,
str
):
append
(
cat
)
else
:
requires_update
=
1
if
requires_update
:
self
.
setCategoryList
(
context
,
tuple
(
categories
))
# Catalog related methods
def
updateRelatedCategory
(
self
,
category
,
previous_category_url
,
new_category_url
):
new_category
=
re
.
sub
(
'^%s$'
%
...
...
product/ERP5/tests/testResource.py
View file @
20a82576
...
...
@@ -862,20 +862,19 @@ class TestResource(ERP5TypeTestCase):
self
.
tic
()
# Test the cases
for
product
,
variation
,
node
,
base_price
in
test_case_list
:
categories
=
[]
if
node
is
not
None
:
self
.
logMessage
(
"Check product %s with destination section %s"
%
\
(
product
.
getTitle
(),
node
.
getTitle
()),
tab
=
1
)
self
.
assertEquals
(
base_price
,
product
.
getPrice
(
categories
=
[
'destination_section/%s'
%
node
.
getRelativeUrl
(),
variation
]))
categories
.
append
(
'destination_section/'
+
node
.
getRelativeUrl
())
else
:
self
.
logMessage
(
"Check product %s without destination section"
%
\
product
.
getTitle
(),
tab
=
1
)
self
.
assertEquals
(
base_price
,
product
.
getPrice
(
categories
=
[
variation
]))
if
variation
:
categories
.
append
(
variation
)
self
.
assertEqual
(
base_price
,
product
.
getPrice
(
categories
=
categories
))
# The following test tests Movement.getPrice, which is based on the movement
...
...
product/ERP5Type/Base.py
View file @
20a82576
...
...
@@ -2175,9 +2175,6 @@ class Base( CopyContainer,
"""
return
self
.
_getCategoryTool
().
getAcquiredCategoryList
(
self
)
def
_getAcquiredCategoryList
(
self
):
return
self
.
_getCategoryTool
().
_getAcquiredCategoryList
(
self
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setCategoryList'
)
def
setCategoryList
(
self
,
path_list
):
self
.
portal_categories
.
setCategoryList
(
self
,
path_list
)
...
...
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