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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
6faa1b16
Commit
6faa1b16
authored
Nov 17, 2014
by
Alain Takoudjou
Committed by
Rafael Monnerat
Apr 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly cleanup path for category setter
parent
fa6ceb99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
product/CMFCategory/tests/testCMFCategory.py
product/CMFCategory/tests/testCMFCategory.py
+19
-0
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+2
-1
No files found.
product/CMFCategory/tests/testCMFCategory.py
View file @
6faa1b16
...
@@ -1148,6 +1148,25 @@ class TestCMFCategory(ERP5TypeTestCase):
...
@@ -1148,6 +1148,25 @@ class TestCMFCategory(ERP5TypeTestCase):
self
.
assertEqual
(
list
(
related
),
[
person
.
getRelativeUrl
()])
self
.
assertEqual
(
list
(
related
),
[
person
.
getRelativeUrl
()])
person
.
_setTest1Value
(
a
)
person
.
_setTest1Value
(
a
)
self
.
assertEqual
(
list
(
related
),
[])
self
.
assertEqual
(
list
(
related
),
[])
def
test_Category_setCategoryValue
(
self
):
# Test all case of setting categories values
region_value
=
self
.
portal
.
portal_categories
.
resolveCategory
(
'region/europe'
)
region_value2
=
self
.
portal
.
portal_categories
.
resolveCategory
(
'region/europe/west'
)
self
.
assertNotEqual
(
None
,
region_value
)
self
.
assertNotEqual
(
None
,
region_value2
)
newPerson
=
self
.
getPersonModule
().
newContent
person
=
newPerson
()
person
.
setRegionValue
(
region_value
)
person2
=
newPerson
(
region_value
=
region_value2
)
self
.
tic
()
self
.
assertEqual
(
person
.
getRegion
(),
'europe'
)
self
.
assertTrue
(
'region/europe'
in
person
.
getCategoryList
())
self
.
assertEqual
(
person2
.
getRegion
(),
'europe/west'
)
self
.
assertTrue
(
'region/europe/west'
in
person2
.
getCategoryList
())
def
test_suite
():
def
test_suite
():
...
...
product/ERP5Type/Base.py
View file @
6faa1b16
...
@@ -1818,9 +1818,10 @@ class Base( CopyContainer,
...
@@ -1818,9 +1818,10 @@ class Base( CopyContainer,
def
_setValue
(
self
,
id
,
target
,
spec
=
(),
filter
=
None
,
portal_type
=
(),
keep_default
=
1
,
def
_setValue
(
self
,
id
,
target
,
spec
=
(),
filter
=
None
,
portal_type
=
(),
keep_default
=
1
,
checked_permission
=
None
):
checked_permission
=
None
):
getRelativeUrl
=
self
.
getPortalObject
().
portal_url
.
getRelativeUrl
getRelativeUrl
=
self
.
getPortalObject
().
portal_url
.
getRelativeUrl
def
cleanupCategory
(
path
):
def
cleanupCategory
(
path
):
# prevent duplicating base categories and storing "portal_categories/"
# prevent duplicating base categories and storing "portal_categories/"
for
start_string
in
(
"
%s/"
%
id
,
"portal_categories/"
):
for
start_string
in
(
"
portal_categories/"
,
"%s/"
%
id
):
if
path
.
startswith
(
start_string
):
if
path
.
startswith
(
start_string
):
path
=
path
[
len
(
start_string
):]
path
=
path
[
len
(
start_string
):]
return
path
return
path
...
...
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