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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
914d58f5
Commit
914d58f5
authored
Aug 01, 2018
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix export of categories
parent
fcaa4499
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_constructCategoryTableToExport.py
.../erp5_core/CategoryTool_constructCategoryTableToExport.py
+1
-1
product/ERP5/tests/testERP5Core.py
product/ERP5/tests/testERP5Core.py
+23
-5
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/CategoryTool_constructCategoryTableToExport.py
View file @
914d58f5
...
@@ -15,7 +15,7 @@ for base_cat_id in context.REQUEST['category_list']:
...
@@ -15,7 +15,7 @@ for base_cat_id in context.REQUEST['category_list']:
for
cat
in
context
.
portal_catalog
(
portal_type
=
'Category'
,
for
cat
in
context
.
portal_catalog
(
portal_type
=
'Category'
,
sort_on
=
((
'path'
,
'ascending'
),),
# This sorting is not enough.
sort_on
=
((
'path'
,
'ascending'
),),
# This sorting is not enough.
limit
=
None
,
limit
=
None
,
**
{
'default_%s_uid'
%
(
base_cat
.
getId
(),):
base_cat
.
getUid
()}
):
relative_url
=
"%s/%%"
%
base_cat
.
getRelativeUrl
()
):
cat_relative_url_path_list
=
cat
.
getRelativeUrl
().
split
(
'/'
)
cat_relative_url_path_list
=
cat
.
getRelativeUrl
().
split
(
'/'
)
cat_depth
=
len
(
cat_relative_url_path_list
)
cat_depth
=
len
(
cat_relative_url_path_list
)
temporary_category_list
.
append
((
cat_relative_url_path_list
,
cat
))
temporary_category_list
.
append
((
cat_relative_url_path_list
,
cat
))
...
...
product/ERP5/tests/testERP5Core.py
View file @
914d58f5
...
@@ -664,8 +664,26 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -664,8 +664,26 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
response
.
getStatus
(),
401
)
self
.
assertEqual
(
response
.
getStatus
(),
401
)
self
.
assertNotIn
(
"Also, the following error occurred"
,
str
(
response
))
self
.
assertNotIn
(
"Also, the following error occurred"
,
str
(
response
))
def
test_suite
():
def
testCategoryExport
(
self
):
suite
=
unittest
.
TestSuite
()
"""
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5Core
))
Check we can export categories in a spreadsheet
return
suite
"""
portal
=
self
.
getPortalObject
()
category_tool
=
portal
.
portal_categories
base_category_id
=
"test_category_export"
if
getattr
(
category_tool
,
base_category_id
,
None
)
is
not
None
:
category_tool
.
manage_delObjects
(
ids
=
[
base_category_id
])
base_category
=
category_tool
.
newContent
(
portal_type
=
"Base Category"
,
id
=
base_category_id
)
base_category
.
newContent
(
portal_type
=
"Category"
,
reference
=
"Rfoo"
,
id
=
"foo"
,
codification
=
"CFoo"
,
title
=
"Foo"
)
base_category
.
newContent
(
portal_type
=
"Category"
,
short_title
=
"SBar"
,
id
=
"bar"
,
int_index
=
3
,
description
=
"desc"
,
title
=
"Bar"
)
self
.
tic
()
self
.
portal
.
REQUEST
.
set
(
"format"
,
"csv"
)
self
.
portal
.
REQUEST
.
set
(
"category_list"
,
[
base_category_id
])
csv_data
=
category_tool
.
CategoryTool_exportCategory
()
self
.
assertEqual
(
"""Path,Id,Title,Short Title,Reference,Codification,Int Index,Description
*,bar,Bar,SBar,,,3,desc
*,foo,Foo,,Rfoo,CFoo,,
"""
,
csv_data
)
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